PhpStorm 2023.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 Support 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, place 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 Support 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: 25 March 2024