一、擴展的地址
https://github.com/barryvdh/laravel-ide-helper
二、安裝擴展
1、引入庫:
composer require barryvdh/laravel-ide-helper
composer require doctrine/dbal
如果只想在開發環境上使用,請加上--dev
composer require --dev barryvdh/laravel-ide-helper
composer require --dev doctrine/dbal
2、在config/app.php的?providers 數組中添加:
Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class
3、運行命令,生成提示文檔
php artisan clear-compiled
php artisan ide-helper:generate
4、如果想每次提交時自動更新文檔,可以配置composer.json
"scripts":{"post-update-cmd": ["Illuminate\\Foundation\\ComposerScripts::postUpdate","php artisan ide-helper:generate","php artisan ide-helper:meta"]
},
5、由于擴展會生成相應的文件,可能只針對當前開發者有用,所以需要添加到.gitignore中
.idea
_ide_helper.php
_ide_helper_models.php
.phpstorm.meta.php
?