DEV Community

Cover image for Running Laravel IDE Helper Generator automatically
Richard Dobroň
Richard Dobroň

Posted on

Running Laravel IDE Helper Generator automatically

When working on Laravel projects, I always try to keep working on hooks and automation.

There is no exception in this case when using the package barryvdh/laravel-ide-helper that generates helper files that enable your IDE to provide accurate autocompletion.

If you are working on a project where you regularly add database migrations then you will definitely find it handy to automatically call the command to generate those helpers.

The solution is very simple. Just register event listener MigrationsEnded in the file app/Providers/EventServiceProvider.php like this:

You can customize the artisan command according to your needs.

Of course, I recommend creating the same command for the composer.json:

Then just simply run:

composer run scripts
Enter fullscreen mode Exit fullscreen mode

Top comments (0)