In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to use the PHPStorm editor to develop Laravel applications, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
It is believed that many PHP programmers use [laravel] to create their applications. [laravel] is a free and open source PHP web application framework. It is based on multiple Symfony components and provides a development framework, including authentication, routing, sessions, caching and other modules.
Last summer, we introduced support for Blade. Blade is the template language of Laravel, artist-friendly, this Laravel programmer's command line tool, can work in PhpStorm. Using the Laravel plug-in and Laravel IDE helper, we can further extend PhpStorm's support for Laravel applications. Now let's see what to do!
Install Laravel IDE Assistant
Official way
First of all, confirm that Composer is available in our project, we can use Composer | Add dependency... Right-click menu to install [Laravel 5 IDE Helper Generator] to our project. Search for barryvdh/laravel-ide-helper and click Install to download and add to the project.
Self-help mode
Because we are using it in the project, we add this feature to the project and add the require-dev branch to the composer.json
Laravel 4.*, the version here should be 1.*
Require-dev: {/ /. "barryvdh/laravel-ide-helper": "2.*" / /.}
Then use the command composer update-vvv to update the package
Register the 'Barryvdh\ LaravelIdeHelper\ IdeHelperServiceProvider' service to our application.
That is, it is written to the provider in config/app.php, so that there is a command for ide-helper in artisan list. Run artisan ide-helper:generate, and PhpStorm will have code completion and Laravel syntax highlighting.
Laravel plug-in in PhpStorm
To further enhance our Laravel experience, we can also install the Laravel plug-in. In Settings (Preferences) | Plugins, click Browse repositories... Button and search for Laravel. The Install plugin button downloads and installs the plug-in to IDE.
Restart IDE and enable the plug-in (Settings (Preferences) | Other Settings | Laravel Plugin | Enable Plugin for this Project). PhpStorm knows what the Laravel interface does and provides code completion (controllers,views, routes, configuration, translations, etc.)!
Of course, it's not just code completion, but using Ctrl+Click (CMD+Click Mac OS X) or Go To Declaration (go to definition) (Ctrl+B / CMD+B), PhpStorm will navigate there, such as the declaration of configuration items.
With regard to the use of Blade templates, the Laravel plug-in can also improve the experience, such as the automatic completion of the @ section instruction.
Want to know more? Check out our Laravel tutorial, which contains everything PhpStorm has prepared for Laravel development, including code completion, navigation, automatic code review, command line tool support, debugging, and unit testing!
You can also add a command to the post-update-cmd of composer.json to ensure that helper is updated every time you update, as follows:
"post-update-cmd": ["php artisan clear-compiled", "php artisan ide-helper:generate", "php artisan optimize"]
In addition, if your model is the Eloquent of extend, this plug-in can also add phpDoc to the model in the project, directly display the field name, easy to read, usage
Php artisan ide-helper:models User
You need to modify the composer.json and add it in the require-dev section
"require-dev": {"doctrine/dbal": "~ 2.3"}, thank you for reading this article carefully. I hope the article" how to use PHPStorm Editor to develop Laravel applications "shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.