The plugin enables analysis of PHP projects within SonarQubeTM.
It is compatible with the Issues Report plugin to run pre-commit local analysis.
- Install the PHP Environment
- Install the plugin through the Update Center or download it into the SONARQUBE_HOME/extensions/plugins directory
- Restart the SonarQube TM server
Run anAnalysis with the SonarQube
Runner (Recommended Way)
To run an analysis of your PHP project, use the SonarQube TM Runner.
You can also have a look at the SonarQube TM Runner documentation page to define a multi-module PHP project.
sonar.phpPmd.skip=true sonar.phpCodesniffer.skip=true sonar.phpDepend.skip=true # Deactiving the PHP Depend plugin is highly discouraged since all the basic metrics rely on it. sonar.phpUnit.skip=true sonar.phpUnit.coverage.skip=true
Configuring PHPUnit to be run by SonarQube
To configure the execution of PHPUnit, it is recommended to create a configuration file and set the path to this file with the
Most of the time, using the exclusion properties will be enough to exclude files from being reported by SonarQubeTM. However, there might be some cases where you really want to exclude files from being analyzed by an external tool (may it be PHP CodeSniffer, PHPMD or PHP Depend):
- a file is badly written and the tool is crashing when analyzing this file, thus preventing SonarQube TM from completing the analysis
- a big number of files must be excluded and there's no need for the external tools to spend time analyzing files that won't be reported in SonarQubeTM
For these specific cases, you should use the
sonar.xxxx.argumentLine property of the external tool to manually define exclusions. For instance, for PHP CodeSniffer, you would add the following property: