Laurvel 5 ide autocompletion

I want to switch to laravel 5, but some problems with the idea are autocomplete. I am using phpstorm. On google, answers always end up being suggested using https://github.com/barryvdh/laravel-ide-helper . But it seems like it is broken for Laravel 5.

I am doing the following steps:

  • Install Laravel 5

    composer create-project laravel/laravel 
  • Require ide-helper

     composer require barryvdh/laravel-ide-helper 
  • Added "Barryvdh \ LaravelIdeHelper \ IdeHelperServiceProvider",

     .... 'Illuminate\Translation\TranslationServiceProvider', 'Illuminate\Validation\ValidationServiceProvider', 'Illuminate\View\ViewServiceProvider', 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider', 
  • Attempt to create an auxiliary file

     artisan ide-helper:generate 

But it is always interrupted by the following error:

 exception 'InvalidArgumentException' with message 'There are no commands defined in the "ide-helper" namespace.' in C:\xampp\htdocs\test\vendor\symfony\console\Symfony\Component\Console\Application.php:501 0 C:\xampp\htdocs\test\vendor\symfony\console\Symfony\Component\Console\Application.php(535): Symfony\Component\Console\Application->findNamespace('ide-helper') 1 C:\xampp\htdocs\test\vendor\symfony\console\Symfony\Component\Console \Application.php(192): Symfony\Component\Console\Application->find('ide-helper:gene...') 2 C:\xampp\htdocs\test\vendor\symfony\console\Symfony\Component\Console\Application.php(126): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Outpu t\ConsoleOutput)) 3 C:\xampp\htdocs\test\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(91): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Out put\ConsoleOutput)) 4 C:\xampp\htdocs\test\artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) 5 {main} 

Maybe someone had the same problem and it can help me. I am open to various autocomplete solutions other than barryvdh ide-helper.

+7
autocomplete phpstorm laravel-5
source share
5 answers

I had the same problem and this fixed:

Before running the php artisan ide-helper:generate command, make sure php artisan clear-compiled and php artisan optimize , as noted here . If this does not fix your problem, look at this and clear the PhpStorm cache by selecting this:

File | Invalidate Caches / Restart

After an automatic restart, PhpStorm is indexed again and everything should work fine.

Sorry for my bad english.

Edited: After these steps, import your Facades, like this use Illuminate\Support\Facades\Auth , link them inside your _ide_helper.php file, for example use Auth .

+14
source share

I ran into the same problem. These are the steps I took to fix this:

  • I double checked that 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider' was correctly added to the providers array in config/app.php .
  • I performed artisan clear-compiled . No effect

Running php artisan config:clear fixes the problem.

+2
source share

This error occurs if the ServiceProvider package is not loaded.

If you have several configuration files (for example, for a different environment), you must make sure that the service provider is well configured in the whole environment in which you use the package.

 config/ local/ app.php app.php 

To ensure that the service provider is configured correctly for your application, you can reset the application configuration:

 dd(\Config::get('app.providers')); 
+1
source share

Try the following:

 php artisan ide-helper:generate 
+1
source share

Below is an updated gist from this month. I tested this and it works in PHPStorm.

Also you do not need to install this through the composer. Copy gist and save it in the root folder as _ide_helper.php .

-one
source share

All Articles