laravel代码自动补全laravel-ide-helper


安装laravel-ide-helper

composer require barryvdh/laravel-ide-helper --dev
php artisan clear-compiled
php artisan ide-helper:generate
php artisan ide-helper:meta
echo .phpstorm.meta.php>>.gitignore
echo _ide_helper.php>>.gitignore
php artisan vendor:publish --provider="Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider" --tag=config

配置laravel-ide-helper

app/Providers/AppServiceProvider.php

if ($this->app->environment() === 'local') {
    $this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
}

composer.json

"post-autoload-dump": [
    "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
    "@php artisan ide-helper:generate",
    "@php artisan ide-helper:meta"
],
"post-update-cmd": [
    "Illuminate\\Foundation\\ComposerScripts::postUpdate",
    "@php artisan ide-helper:generate",
    "@php artisan ide-helper:meta"
]