Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


The plugin enables analysis of PHP projects within SonarQubeTM.

It is compatible with the Issues Report plugin to run pre-commit local analysis.


  1. Install the PHP Environment
  2. Install the plugin through the Update Center or download it into the SONARQUBE_HOME/extensions/plugins directory
  3. 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.

Sample projects are available on GitHub that can be browsed or downloaded: /projects/languages/php.

You can also have a look at the SonarQube TM Runner documentation page to define a multi-module PHP project.


Code Block
sonar.phpDepend.skip=true    # Deactiving the PHP Depend plugin is highly discouraged since all the basic metrics rely on it.

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 sonar.phpUnit.configuration property.


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: