Posts Learn Components Snippets Categories Tags Tools About
/

Make PhpStorm Smarter for Laravel Development

Learn how to make PhpStorm smarter for Laravel development by allowing for accurate autocompletion and more with Laravel IDE helper

Created on Aug 04, 2021

334 views

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": [
        "Illuminate\\Foundation\\ComposerScripts::postUpdate",
        "@php artisan ide-helper:generate",
        "@php artisan ide-helper:models -W",
        "@php artisan ide-helper:meta"
    ]
}

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

Load comments for Make PhpStorm Smarter for Laravel Development

new

PostSrc Code Components

Collection of Tailwind CSS components for everyone to use. Browse all of the components that are right for your project.

View Components

Sponsors 👑

+ Add Yours
)