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.
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.
1 Open PHPStorm, click on the Settings/Preferences menu, select the Plugins option and click on the Browse repositories button:
2 Select SensioLabsInsight plugin from the list and click on the Install plugin button.
3 Restart PHPStorm for the changes to take effect.
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:
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:
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.
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:
Once clicked, you'll see the project details and a few shortcuts for common SensioLabsInsight 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 SensioLabsInsight configuration section:
2 In the Project on SensioLabsInsight section, click on the Select project button:
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.
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.
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.