PhpStorm 2019.3 Help

Symfony Templates

Web applications commonly comprise a number of pages usually rendered on the server using Twig or PHP-based templates.

Code completion for templates

The Symfony Plugin enables context-aware completion Ctrl+Space for template names:

Symfony template name completion

Code navigation for templates

To navigate to the declaration of a template, position the caret at its usage and press Ctrl+B. Alternatively, Ctrl+Click the usage.

Navigating to Symfony template declaration

Creating a Template by using a Quick-Fix

Situations in which you refer to a template that is yet to be created are quite common. Instead of switching to the Project Tool Window or the Navigation Bar and using the mouse or keyboard shortcuts to navigate to the correct directory and create a new template, use the Create Template quick-fix provided by the Symfony Plugin. This will create the template at the correct location in your project and bundle and immediately open the template in a new editor tab.

Creating a Symfony template via intention action
Last modified: 13 December 2019