Home / Snippets / Make PhpStorm Smarter for Laravel Development
Make PhpStorm Smarter for Laravel Development cover

Make PhpStorm Smarter for Laravel Development


2 years ago


To make PhpStorm smarter and provide accurate autocompletion for Laravel development, you can install the Laravel IDE Helper Generator package by Barry vd. Heuvel.

This package will help to generate all the necessary files, metadata, and docblocks that will allow PhpStorm to know more about the classes, methods, and properties.

Step 1 - Install Laravel IDE Helper
Require the package using composer.
composer require --dev barryvdh/laravel-ide-helper

Step 2 - Run Command to Generate PHPDoc
Once it's installed, you can run the command to generate the PHPDoc.
php artisan ide-helper:generate
php artisan ide-helper:models -W
php artisan ide-helper:meta

Step 3 - Invalidate Caches / Restart PhpStorm
The final step is to invalidate existing caches or restart your PhpStorm to let it re-index all of the files.

Optional: Publish Configuration
To publish configuration you can run the command below.
php artisan vendor:publish --provider="Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider" --tag=config

Optional: Composer Post Update Command
Sometimes you don't want to type out the command to re-generate the PHPDoc, to automatically do that after "composer update" you add the following "post-update-cmd" which will run after updating dependencies.
# composer.json
"scripts": {
    "post-update-cmd": [
        "@php artisan ide-helper:generate",
        "@php artisan ide-helper:models -W",
        "@php artisan ide-helper:meta"
notion avatar


Week-end developer currently experimenting with web, mobile, and all things programming.






Support Us

If you like our tutorial, support us by being our Patreon or buy us some coffee ☕️

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this