laravel安装laravel-ide-helper扩展进行代码提示(二)

董哲
2023-12-01

一、扩展的地址

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

  

 

转载于:https://www.cnblogs.com/jkko123/p/10677785.html

 类似资料: