PhpStorm 2024.1 Help

Symfony code completion and navigation

The Symfony Support plugin enhances PhpStorm's built-in support for Symfony with code completion and navigation features. This plugin is not bundled with PhpStorm and needs to be installed and enabled on a per-project basis.

The Symfony Support plugin is open source. You can find the source code for the plugin, as well as its issue tracker, on GitHub.

Enabling the Symfony Support plugin for a project

After you install the Symfony Support plugin, you need to explicitly enable it for the project. After creating or opening a Symfony project, PhpStorm will display a notification message suggesting you enable the plugin.

Enable the Symfony Support plugin for a project

  1. Do any of the following:

    • Click the Enable plugin link in the notification message.

      Symfony Support plugin notification
    • In the Settings dialog (Ctrl+Alt+S) , navigate to PHP | Symfony and select the Enable Plugin for this Project checkbox.

  2. Restart PhpStorm for the changes to take effect.

Specifying additional settings

Depending on how the Symfony project is structured, you may have to change some additional settings under PHP | Symfony. When working with a Symfony application that follows the structure generated by, for example, the symfony/framework-standard-edition Composer project, the default paths and settings will work fine.

Note that the appDevDebugProjectContainer.xml and appDevUrlGenerator.php files must be located under Symfony's default path in order to work with all features the Symfony Support plugin provides. It will use a fallback mechanism when these files cannot be found, but completion and navigation will be less precise in this case.

When using a non-default project structure, the following paths should be updated in the Symfony settings:

  • Translation Root Path: the path to the location where all translations are copied. This should be set to the translations path under the cache folder, so that all possible translations are discovered by the plugin. In Symfony 4 and later, the default path is ./var/cache/dev/translations/.

  • App Directory: the path to the app directory. In Symfony 4 and later, the default path is ./config/.

  • Web Directory: the path to the web directory. In Symfony 4 and later, the default path is ./public/.

Symfony general settings

Symfony profiler

When the Symfony Support plugin is enabled for a project, an additional region will be added to the PhpStorm status bar. Clicking Symfony in the status bar will open the popup menu with the related targets for the latest requests being made to our Symfony application.

Symfony profiler toolbar
  • Click the corresponding item in the profiler popup menu:

    • Debug URL: the Symfony profiler URL for the given request, for example, /app_dev.php/_profiler/355651.

    • Routes: the route registration in the application

    • Controller: the controller that was involved in creating a response.

    • Template: any of the templates related to a response.

Last modified: 04 April 2024