Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

Getting started

Let's get started by installing the Symfony2 Plugin and checking how we can enable Symfony2-specific features in our PHP projects.

Installing the Symfony2 Plugin

The Symfony2 Plugin can be installed from within our IDE from IDE Settings | Plugins. Here we can see the list of installed plugins and browse third-party plugin repositories using the Browse repositories... button. Feel free to explore several of the other plugins in there.

After clicking Browse repositories..., search for Symfony2 and select the Symfony2 Plugin. This will show the plugin description. Click the Install Plugin button and confirm plugin installation to continue.

Once we save the settings, PhpStorm will ask us if we want to restart the IDE. We must do this to activate and load the plugin.

Enabling the Symfony2 Plugin for a project

The plugin, even after installing it in the IDE, will not do its magic until after we explicitly enable it for the project. After creating or opening a Symfony2 project in PhpStorm, the IDE will show us a pop-up with instructions on how we can enable the plugin.

We can click the Project Settings hyperlink, or alternatively go through Project Settings | Symfony2 Plugin and select the check-box Enable Plugin for this Project. Clicking OK will save our changes to the settings. Note that PhpStorm will have to be restarted for the plugin to pick up this change in configuration.

After restarting PhpStorm, we're good to go!


Depending on how our Symfony2 project is structured, we may have to change some other settings under Project Settings | Symfony2 Plugin. When working with a Symfony2 application that follows the structure generated by, for example, the symfony/framework-standard-edition Composer project, the default paths and settings will work fine.

Important! The appDevDebugProjectContainer.xml and appDevUrlGenerator.php should be located under Symfony2's default path in order to work with all features the Symfony2 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 Symfony2 Plugin settings:

  • Path to urlGenerator.php: path to Symfony2 URL generator.
  • Translation Root Path: path to where all translations are copied. This is best set to the translations path under the cache folder so all possible translations can be discovered by the plugin.
  • App Directory: path to the app directory.
  • Web Directory: path to the web directory.

Symfony2 Code Style

Pre-configured Symfony2 Code Style has been available in PhpStorm for a while. It can be configured through Project Settings | Code Style | PHP | Set From... | Predefined Style | Symfony2. Setting the Symfony2 Code Style ensures PhpStorm adheres to the style guidelines described in the Symfony2 Coding Standards.

  • No labels