Description / Features
The plugin enables analysis of PHP source code with SonarQube. Pure PHP files and mixed HTML / PHP files can be analyzed.
Since version 2.1
You can check compliance with PHP coding standards:
- PSR-2: the quality profile of this name contains the rules to be PSR-2 compliant.
- Install the plugin through the Update Center or download it into the SONARQUBE_HOME/extensions/plugins directory
- Restart the SonarQube server
Run an Analysis with the SonarQube Runner (Recommended method)
To run an analysis of your PHP project, use the SonarQube Runner.
You can also have a look at the SonarQube Runner documentation page to define a multi-module PHP project.
Run an Analysis with the other Analyzers
Unit Tests and Code Coverage
To display unit test execution and code coverage data:
- Prior to the SonarQube analysis, execute your unit tests and generate a report in Clover XML format (execution + code coverage).
- Import these reports while running the SonarQube analysis by setting the:
sonar.php.coverage.reportPathproperty to the path to the PHPUnit code coverage report file. The path may be either absolute or relative to the project base directory.
sonar.php.tests.reportPathproperty to the path to the PHPUnit unit test execution report file. The path may be either absolute or relative to the project base directory.
The PHP plugin does not rely anymore on external tools.