https://github.com/barryvdh/laravel-ide-helper
安装
composer require --dev barryvdh/laravel-ide-helper
设置服务提供者
config/app.php:
Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
5.5及以上版本不需要设置
设置只在开发环境中加载
app/Providers/AppServiceProvider.php:
public function register()
{
if ($this->app->environment() !== 'production') {
$this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
}
// ...
}
设置自动更新
conposer.json:
"scripts":{
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan ide-helper:generate",
"php artisan ide-helper:meta"
]
},
发布配置文件
php artisan vendor:publish --provider="Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider" --tag=config
设置链式调用支持
config/ide-helper.php:
'include_fluent' => true,