SensioLabsInsight
SensioLabsInsight is a quality assurance service that analyzes source code to find problems that degrade the overall quality of your projects. It can analyze any application developed with PHP, and has specially designed rules to perform advanced analysis of various projects types such as Symfony applications, Laravel websites, Drupal modules, and more. Each analysis generates a highly detailed report with all the found problems, ranging from performance issues to potential security exploits. In addition, every error is explained within the context of your own code and includes comprehensive documentation on how to fix it.
SensioLabsInsight seamlessly integrates with PhpStorm via the SensioLabsInsight plugin. This plugin shows all inspection results in the editor gutter, provides handy navigation to full SensioLabsInsight report, and a lot more. In this tutorial we’ll look into how to get started with the SensioLabsInsight service, configure the integration, and proceed with improving your project code quality thanks to additional inspections provided by the SensioLabsInsight service.
You can watch a video tutorial to learn more about SensioLabsInsight integration with PhpStorm.
Before you start
Before you start working with SensioLabsInsight, make sure that SensioLabsInsight plugin is installed and enabled. Press Ctrl+Alt+S, go to Plugins and inspect the Installed tab to ensure the plugin is enabled.
Enabling SensioLabsInsight integration with PhpStorm
To familiarize yourself with SensioLabsInsight, refer to the Getting started with SensioLabsInsight tutorial.
Having installed the SensioLabsInsight plugin, you need to enable integration with your SensioLabsInsight account for the project. After creating or opening a project, PhpStorm will display a notification message suggesting you configure the plugin.
To connect PhpStorm to your SensioLabsInsight account
Do any of the following:
Click the Configure link in the notification message.
In the Settings/Preferences dialog (Ctrl+Alt+S), click SensioLabsInsight.
Provide your SensioLabsInsight User UUID and API token in the corresponding fields. You can find these values on the Account | API/SDK SensioLabsInsight page.
To save these authentication settings as default settings to be used in all other projects, select the Save as default API settings checkbox.
Restart PhpStorm for the changes to take effect.
Configuring SensioLabsInsight Integration with a PhpStorm project
To enable SensioLabsInsight integration for an existing project, just make sure that it's pointing to the same VCS repository that you've used in the SensioLabsInsight web interface. To check the current VCS root configuration for your project, in the Settings/Preferences dialog (Ctrl+Alt+S), click Version Control.
![Version Control System settings Version Control System settings](https://resources.jetbrains.com/help/img/idea/2022.1/ps_vcs_screen.png)
If you've configured the connection to your SensioLabsInsight account, the plugin will automatically associate with specific projects based on the remote URL. You can view the currently selected project, or select a project manually on the SensioLabsInsight page of the Settings/Preferences dialog:
![Select project Select project](https://resources.jetbrains.com/help/img/idea/2022.1/ps_SensioLabsInsight_prefs_select_project.png)
If you want to create a new project, proceed as described in Creating New Project from Scratch. If a project is checked out from a VCS, it'll be automatically associated with relevant SensioLabsInsight project (based on its remote URL); otherwise, you'll need to select it explicitly.
Exploring SensioLabsInsight analysis results in PhpStorm
After the integration between SensioLabsInsight and PhpStorm is configured, the latest report from SensioLabsInsight service is fetched by PhpStorm. All rule violations are displayed in the editor gutter. Click the icon to get a more complete annotation for the rule violation, with an option to navigate directly to the full SensioLabsInsight report.
![SensioLabsInsight inspection rules violation SensioLabsInsight inspection rules violation](https://resources.jetbrains.com/help/img/idea/2022.1/ps_SensioLabsInsight_rule_violation.png)
Running inspections in PhpStorm
SensioLabsInsight inspections are integrated with PhpStorm's built-in inspections, meaning that you can bring up the results of all inspections by means of the
or commands Ctrl+Alt+Shift+I.![Run SensioLabsInsight inspection Run SensioLabsInsight inspection](https://resources.jetbrains.com/help/img/idea/2022.1/ps_SensioLabsInsight_run_inspection.png)
You can also run SensioLabsInsight-based inspections from the SensioLabsInsight panel in the of PhpStorm status bar. Clicking this panel will display all the SensioLabsInsight-related actions. Select Run code inspections and view the inspection results in the Problems tool window.
![SensioLabsInsight bottom panel SensioLabsInsight bottom panel](https://resources.jetbrains.com/help/img/idea/2022.1/ps_SensioLabsInsight_bottom_panel.png)
Updating SensioLabsInsight report in PhpStorm
SensioLabsInsight is all about improving your analysis results continuously, which means that updating your report is an important step. To fetch the latest report from the SensioLabsInsight server, in the SensioLabsInsight panel in the PhpStorm's status bar, click Sync with latest analysis on SensioLabsInsight:
![SensioLabsInsight sync SensioLabsInsight sync](https://resources.jetbrains.com/help/img/idea/2022.1/ps_SensioLabsInsight_sync.png)
For maximum performance, make sure to configure your SensioLabsInsight project to be re-analyzed on every commit. On synchronizing with server, PhpStorm plugin will automatically get analysis report on current commit hash or corresponding branch.
Navigating to the SensioLabsInsight dashboard
To navigate to the SensioLabsInsight dashboard, do any of the following:
Click the
icon in the editor gutter.
Click the link in the Inspection results tool window.
Select the corresponding action in the SensioLabsInsight panel in the PhpStorm's status bar: