We can use Ctrl Click ( CMD Click on Mac OS X) or Go To Declaration ( Ctrl B / CMD B) to navigate to its declaration. Hovering the mouse with the Ctrl or CMD key pressed will show us where the translation key is defined. With the Laravel plugin installed, calling into Lang::get() and using Ctrl Space ( CMD Space on Mac OS X) will provide us with completion for the various translation keys. Using the Lang facade, we can get translated strings for use in our application. In a similar fashion, PhpStorm provides navigation to Laravel services.Ĭode Completion and Navigation for Translations If multiple declarations are found, PhpStorm will let us choose where we want to navigate to. Hovering the mouse with the Ctrl or CMD key pressed will show additional details. To navigate to the configuration entry's declaration, we can use Ctrl Click ( CMD Click on Mac OS X) or Go To Declaration ( Ctrl B / CMD B). Similarly, the Laravel plugin also provides completion for services. When working with Laravel configuration using the Configuration facade, we get code completion for the various keys that are defined in our application's settings. Simply hovering the mouse with the Ctrl or CMD key pressed will show additional details.Ĭode Completion and Navigation for Configuration and Services Using Ctrl Click ( CMD Click on Mac OS X) or Go To Declaration ( Ctrl B / CMD B), PhpStorm lets us jump directly to the Blade template. Just like with controllers, we can navigate to our views as well. The Laravel plugin provides completion for view names when using this facade: Using the View facade, we can reference a Blade template (or view). Simply hovering the mouse with the Ctrl or CMD key pressed will show additional details. We can also navigate to the controller using Ctrl Click ( CMD Click on Mac OS X) or Go To Declaration ( Ctrl B / CMD B). This works when using the Redirect and Route facade's various functions: When referencing a controller, we can use code completion by pressing Ctrl Space ( CMD Space on Mac OS X) and select the controller from the list that pops up. Code Completion and Navigation for Controllers and Routes Let's explore the Laravel plugin's features for working in PHP code. Running artisan clear-compiled and artisan ide-helper:generate may also be required. In case of any problems with the completion and navigation support provided by this plugins, select File | Invalidate Caches / Restart to reindex your project. In the app/config/app.php file, add Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider' under the providers element: Once installed, we have to add the Laravel IDE helper as a ServiceProvider into our application. Click Install to download the package and add it to our project. context menu and search for barryvdh/laravel-ide-helper. We can use the Composer | Add dependency. Once Composer is available for use in our project, we can install the Laravel IDE helper into our project. PhpStorm can download composer.phar if needed. After opening a Laravel project, select the root node in the project tool window and use the Composer | Init composer. One thing we want to make sure beforehand is that Composer is initialized and configured in PhpStorm. It will make sure we get full Laravel support in PhpStorm, including code completion, navigation, Composer support, Artisan command-line support and additional Blade syntax support. There's a bit of setup work initially, but this is only needed once. Using the Laravel plugin and the Laravel IDE helper, we can extend PhpStorm's support for Laravel applications. It also provides support for Laravel's template engine, Blade. PhpStorm comes with code completion, navigation, automatic inspections, refactoring. Prerequisites (plugin installation and configuration)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |