PHPStorm automatically exits with Laravel 5

I am using PHP Storm v8.0.3 with the latest version of Laravel.

I'm having problems with autocomplete work.

enter image description here

As you can see in the image above.


I installed barryvdh ide-helper following the readme it provides on git. I did not receive any errors during installation.

enter image description here

I included it in the providers array as

'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider'

or

Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider:class

It didn't matter (as far as I can tell).

I also installed the Laravel plugin.

Again, no difference, autofill anyway.

enter image description here

I tried to reset the configuration file, resulting in:

 array:27 [▼ ... 22 => "Illuminate\View\ViewServiceProvider" 23 => "Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider" 24 => "App\Providers\AppServiceProvider" ... ] 

I am really stuck with this. I have no idea what could be wrong. Any push in the right direction is welcome.

+8
php phpstorm laravel
source share
4 answers

Two possible fixes for this:

  • Make your models an extension of the facade \ Eloquent instead of Lighten \ Database \ eloquent \ Model.
  • If you prefer to use the Model Facade, you can create your own alias in config / app.php, then change the "eloquent" to "model" in config / ide-helper.php in the advanced section. This will allow ide-helper to include all the methods from Illuminate \ Database \ Eloquent \ Builder and Illuminate \ Database \ Query \ Builder, where the missing methods actually live.

(Source: https://laracasts.com/discuss/channels/general-discussion/phpstorm-thinks-modelwhere-doesnt-exist-on-model-l5/replies/37661 )

+10
source share

In addition to the IDE helper, you must enable the Laravel plugin for each project in PHPStorm.

  • Open settings.
  • Go to Laravel Plugin
  • Check Enable plugin for this project
+1
source share

In this article, I logged in with PHPStorm 2016.1.2, but a year older, so I believe it will work with the old version.

https://blog.jetbrains.com/phpstorm/2015/01/laravel-development-using-phpstorm/

The only details that are probably missing, I found them on the GitHub plugin link:

After updating the composer, add the service provider to the providers array in config/app.php Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,

php artisan ide-helper:generate

Note: first you need to clean bootstrap / compiled.php, so run php artisan with an explicit compiler before generation (and optimize php-artisan after).

Source: https://github.com/barryvdh/laravel-ide-helper

+1
source share

I tried all the answers, but after I turned on doctrine/dbal for automatic phpDocs for models, autocomplete code started working, because automatic phpDocs for models added @mixin \Eloquent , and this does the trick and much more;)

actions:

 https://github.com/barryvdh/laravel-ide-helper Require this package with composer using the following command: composer require barryvdh/laravel-ide-helper After updating composer, add the service provider to the providers array in config/app.php Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class, php artisan clear-compiled php artisan ide-helper:generate php artisan optimize You can configure your composer.json to do this after each commit: "scripts":{ "post-update-cmd": [ "Illuminate\\Foundation\\ComposerScripts::postUpdate", "php artisan ide-helper:generate", "php artisan ide-helper:meta", "php artisan optimize" ] }, composer require doctrine/dbal php artisan ide-helper:models 
0
source share

All Articles