我决定在我的新 Laravel 项目中使用 PhpStorm,所以我想我想要一些自动完成功能.我确实阅读了 blog.jetbrains 的指南/phpstorm/2015/01/laravel-development-using-phpstorm/,其中一些工作正常,但我遇到了问题.
I decided to use PhpStorm for my new Laravel project, so I thought I wanted some autocompletion. I did read the guide from blog.jetbrains/phpstorm/2015/01/laravel-development-using-phpstorm/ and some of it works fine, but I got a problem.
我想测试我的数据库连接,所以我做了一个简单的index()函数
I wanted to test my DB connection, so I just made a simple index() function like this
if(DB::connection()->getDatabaseName()) { echo 'Connected to ' . DB::connection()->getDatabaseName(); }哪个工作正常,但是当我写 DB 并按 Tab 时,我写的是 \DB:: 而不是 DB::.然后我包括 use Illuminate\Support\Facades\DB; 和 DB:: 作品.但是当我添加门面时,自动完成完全不一样,它找不到方法但它们有效.真的很烦.
Which works fine, but when I write DB and press Tab I write \DB:: instead of DB::. Then I include use Illuminate\Support\Facades\DB; and DB:: works. But when I added the facade, the autocompletion isn't the same at all and it cant find the methods but they works. It's really annoying.
其他人遇到了这个问题,有解决方案吗?
Someone else had this problem and is there a solution for it?
推荐答案在 PhpStorm 中,设置 => 插件
In PhpStorm, Settings => plugins
- 搜索 laravel 的存储库并安装.
然后在添加这个包之后:
Then after add this package:
composer 需要 barryvdh/laravel-ide-helper
你可以在 github 上找到关于这个包的更多帮助:github/barryvdh/laravel-ide-helper
You can find more help on github for this package:github/barryvdh/laravel-ide-helper
更多推荐
PhpStorm 和 Laravel 自动补全
发布评论