Documentation

Doc index page

Integrate SensioLabsInsight into PHPStorm

SensioLabsInsight 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 SensioLabsInsight now integrates seamlessly with PHPStorm, the leading PHP IDE.

Prerequisites

This tutorial assumes that you already have a SensioLabsInsight 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.

SensioLabsInsight 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 SensioLabsInsight plugin from the list and click on the Install plugin button.

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

3 Restart PHPStorm for the changes to take effect.

SensioLabsInsight plugin configuration

Before using the plugin, you must connect it with your SensioLabsInsight account:

1 Click on the PHPStorm's Settings/Preferences menu and look for the new SensioLabsInsight 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 SensioLabsInsight's dashboard link at the top of this window:

/help/images/phpstorm-plugin-configure-sensiolabsinsight-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 SensioLabsInsight 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 SensioLabsInsight. 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 SensioLabsInsight panel at the bottom of the PHPStorm window:

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

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

/help/images/phpstorm-plugin-sensiolabsinsight-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 SensioLabsInsight configuration section:

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

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

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

3 PHPStorm will show you the list of projects configured in your SensioLabsInsight account. Select the project to analyze and click on the OK button to save the changes.

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

Exploring your SensioLabsInsight 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 SensioLabsInsight 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 SensioLabsInsight 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 SensioLabsInsight panel at the bottom of the PHPStorm window and click on the Sync with latest analysis on SensioLabsInsight option.

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