Documentation

Doc index page

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.

Prerequisites

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:

/help/images/phpstorm-plugin-install-jetbrains-plugin.png

2 Select SymfonyInsight plugin from the list and click on the Install plugin button.

/help/images/phpstorm-plugin-install-insight-plugin.png

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:

/help/images/phpstorm-plugin-sensiolabs-configuration-section.png

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:

/help/images/phpstorm-plugin-configure-insight-credentials.png

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:

/help/images/phpstorm-plugin-insight-panel.png

Once clicked, you'll see the project details and a few shortcuts for common SymfonyInsight actions:

/help/images/phpstorm-plugin-insight-panel-project-details.png

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:

/help/images/phpstorm-plugin-sensiolabs-configuration-section.png

2 In the Project on SymfonyInsight section, click on the Select project button:

/help/images/phpstorm-plugin-select-insight-project.png

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.

/help/images/phpstorm-plugin-insight-project-list.png

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.

/help/images/phpstorm-plugin-code-quality-violation-marker.png

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.

/help/images/phpstorm-plugin-insight-panel-sync-report.png