PhpStorm 2018.2 Help

Working with 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:

ps 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 (for Windows and Linux) or ⌘+Click (for macOS) the usage.

ps symfony jump to template declaration

Creating a Template 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.

ps symfony create template intention
Last modified: 18 September 2018