Integrate SymfonyInsight into PHPStorm¶
SymfonyInsight helps you get back control over your PHP applications, by identifying flaws and providing support in fixing them during your continuous integration process, and giving you an objective rating of errors and technical debt assessment.
However, in order to boost your productivity and streamline your workflow, it would be better to have the analysis results integrated into the development tools that you use on a daily basis. That's why SymfonyInsight now integrates seamlessly with PHPStorm, the leading PHP IDE.
This tutorial assumes that you already have a SymfonyInsight account and have performed some code analysis. If you haven't, consider reading first the Getting Started tutorial.
In addition, you must have installed PHPStorm version 7 or higher. If you haven't, consider downloading a free evaluation copy from its website.
SymfonyInsight plugin installation¶
1 Open PHPStorm, click on the Settings/Preferences menu, select the Plugins option and click on the Browse repositories button:
2 Select SymfonyInsight plugin from the list and click on the Install plugin button.
3 Restart PHPStorm for the changes to take effect.
SymfonyInsight plugin configuration¶
Before using the plugin, you must connect it with your SymfonyInsight account:
1 Click on the PHPStorm's Settings/Preferences menu and look for the new SymfonyInsight configuration section:
2 In the API Settings section, type in your User UUID and your API token. The easiest way to get these values is to click on the Open SymfonyInsight's dashboard link at the top of this window:
Since these values can be configured from one PHPStorm project to another, check the Save as default API settings option to avoid having to introduce these values again for the rest of your projects.
3 Click OK button to save the changes and PHPStorm will now be ready to show you the results of the SymfonyInsight analysis.
Integrating Code Quality Analysis in PHPStorm¶
Selecting the project¶
Generally, your PHPStorm project will point to the same VCS repository used when adding the project to SymfonyInsight. In this case, PHPStorm will show you the analysis results right away without any further configuration.
In order to check if the right project is selected, click on the SymfonyInsight panel at the bottom of the PHPStorm window:
Once clicked, you'll see the project details and a few shortcuts for common SymfonyInsight actions:
If no project is selected or if you want to choose another project, you'll have to select explicitly the project being analyzed:
1 Click on the PHPStorm's Settings/Preferences menu and look for the SymfonyInsight configuration section:
2 In the Project on SymfonyInsight section, click on the Select project button:
3 PHPStorm will show you the list of projects configured in your SymfonyInsight account. Select the project to analyze and click on the OK button to save the changes.
Exploring your SymfonyInsight reports in PHPStorm¶
Now that everything is correctly configured, browse your project's source code and you'll find new icons in the left gutter of your editor. The yellow puzzle piece icon is the marker used to alert you about SymfonyInsight violations.
Move your mouse over those icons and you'll see more information about the code quality violation.
Click on the floating window message and you'll be redirected to that exact violation on SymfonyInsight website, where you'll find all the details about this error.
From time to time, you'll have to synchronize your PHPStorm project to the most recent quality report. To do so, click on the SymfonyInsight panel at the bottom of the PHPStorm window and click on the Sync with latest analysis on SymfonyInsight option.