Search code examples
phplaravelphpstorm

Laravel Intellisense / autocomplete with PhpStorm


Trying to get a clean environment to work on Laravel 5.4 / PhpStorm. Followed all the instructions from: https://github.com/barryvdh/laravel-ide-helper (including installing the PhpStorm Laravel plugin)

Got the file_ide_helper.php generated, added

Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,

to its proper location, cleared cache, restarted...

Please look at attached image, is the lack of intellisense I get supposed to be fixed by the ide helper ?

enter image description here


Solution

  • Ok here is the solution, assuming you have installed the helper already:

    Example:

    Replace in a controller:

    use Illuminate\Support\Facades\Validator;
    

    by

      use Validator
    

    In your config/app.php you must have this alias:

    'Validator' => Illuminate\Support\Facades\Validator::class,
    

    In my case it was already there.

    After this, no more error message for the example shown in the image above and I can use full power of phpstorm that correctly understands the ::make method.

    Source https://github.com/barryvdh/laravel-ide-helper/issues/431#issuecomment-275898789 thanks @lazyone.