Add IDE helper to PhpStom for Laravel
To ease your development experience you can use your IDE helpers, with PhpStorm and Symfony I use them a lot.
Today I do my first try with Laravel, and I have my habits with PhpStorm helpers.
I use Homstead, when I install a new package to my project, I do it from inside the VM.
From inside your project directory use:
vagrant ssh
You will be in your VM, you go to your project directory, for me it’s
cd /home/vagrant/code/laravel/
And you add this:
composer require --dev barryvdh/laravel-ide-helper
Almost there, add this to your app/providers/appServiceProvider.php (à partir de laravel 5.5)
public function register()
{
if ($this->app->environment() !== 'production') {
$this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
}
// ...
}
https://github.com/barryvdh/laravel-ide-helper => repository of the helper for complete doc
Last step after the installation is complete:
artisan ide-helper:generate
This command is to run from the Homestead VM, if you want PhpStorm can open a terminal within the VM for you (Tools -> Start an SSH session … -> select Vagrant -> enjoy).
But I prefer to have a separated terminal because I display it on my 2nd screen.
You have 2 more things to do:
- add the Laravel plugin to PhpStorm
- active the plugin for you project
Go to « File -> Settings » search for « plugins » and for « Laravel » for the second image.
Install it and restart PhpStorm, after that enable the plugin for this project
Done ! Happy coding ^^
Links:
Jetbrain complete help: https://www.jetbrains.com/help/phpstorm/laravel.html
Old blogpost about the helper: https://blog.jetbrains.com/phpstorm/2015/01/laravel-development-using-phpstorm/