Authors |
Gabriele Santini, Frédéric Leroy, Jérôme Tama, Akram Ben Aissi |
Jira |
http://jira.codehaus.org/browse/SONARPLUGINS/component/13723 |
Latest Version |
0.2 ( check version compatibility ) |
License |
LGPL v3 |
Sources |
|
Download |
Core PHP Plugin |
Features
The plugin enables analysis of PHP projects within Sonar. This plugin handles a few analysis tools for PHP projects : PHP Unit, PHP Depend, PHPMD and SQLI CodeSniffer.
Plugin |
PHP Unit |
PHP Depend |
PHPMD |
SQLI CodeSniffer |
|---|---|---|---|---|
0.2 |
3.4.12 |
0.9.12 |
0.2.5 |
0.4.0 |
And of course all built-in functionality of Sonar are available : dashboard, drilldown, clouds...
Installation
- Install PHP
- PHP at least 5.2.6 is required for this procedure and the plugins to work smoothly
- Install PEAR if not included in PHP distribution
- Make sure your PEAR version is strictly bigger than 1.8.0
- (tutorial for MacOS X Leopard)
- Make sure your PEAR version is strictly bigger than 1.8.0
- Install PHP Unit
- Install XDebug
- On Linux/Mac
- you must have phpize installed, normally found in php dev packages like rpm php5-devel, deb php5-dev, ...
- compile xdebug via a pecl install
- This will create an extension xdebug.so
- Windows users must instead use the binaries. Find the right one here
- You must add this line to your cli php.ini
- On Linux/Mac
- Install PHP Depend
- Install PHPMD
- Install SQLI_CodeSniffer
- Follow the instructions here
- Copy the sonar plugins (.jar file) to /extensions/plugins/ directory
- Restart Sonar Web server
Known limitations
This is an alpha version so we expect it to have a lot of bugs/uncovered cases. Please report all bugs you find on Jira.
Metrics in this version are only collected by PHP_Depend, this implies that files containing unstructured code (not OO) will not be included in this kind of analysis.
It is known that copy/paste detection is wrongly extended to comments (see #218).
The actual CodeSniffer standard used by default is just a demo one.
You can include other standards with their configuration files the "SQLI_CodeSniffer way".
We suggest you to wait for the 1.3.0 release of PHP_CodeSniffer that will bring extended configuration capabilities and will be rapidly integrated with the plugins.

