This article mainly introduces you to relevant information on how to use PHPStorm to develop Laravel applications. The article introduces it in great detail through sample code. It has certain reference learning value for everyone's study or work. Friends who need it can follow below. Let’s learn together.
Preface
I believe there are many PHP programmers using [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 Laravel's template language, artist-friendly, and a command-line tool for Laravel programmers that can work in PhpStorm. Using Laravel plugins and Laravel IDE helpers, we can further extend PhpStorm's support for Laravel applications. Let’s see how to do it!
Install Laravel IDE Assistant
Official Way
First 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 barryvdh/laravel-ide-helper, and Click Install to download and add it to the project.
[Translation] Self-service method
Because we are using it in the project, we use it in the project To add this function, add require-dev branch
laravel 4.* in composer.json, the version here should be filled in 1.*
"require-dev": { // ... "barryvdh/laravel-ide-helper": "2.*" // ... },
and then Use the command composer update -vvv to update the package
Register the 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider' service to our application, that is, write it to the provider in config/app.php, so that it will be in the artisan list There is an ide-helper command, run artisan ide-helper:generate, PhpStorm will have code completion function, and have Laravel syntax highlighting.
Laravel plug-in in PhpStorm
"post-update-cmd": [ "php artisan clear-compiled", "php artisan ide-helper:generate", "php artisan optimize" ],
php artisan ide-helper:models User
"require-dev": { "doctrine/dbal": "~2.3" },
Summary in the require-dev section
The above is the detailed content of Detailed explanation of examples of developing Laravel applications with PHPStorm. For more information, please follow other related articles on the PHP Chinese website!