Sonar is a platform for continuously inspecting code quality to detect issues, ensure technical debt is under control, and monitor code complexity, duplications, and potential bugs. It provides visual reporting across projects and allows tracking metrics over time. Sonar supports PHP projects using tools like PHP_Codesniffer, PHPUnit, PHP Depend, and PHP Mess Detector. It can be set up with Maven and integrated with Hudson via a plugin or phpUnderControl via Ant tasks to run analysis as part of the continuous integration build process.
15. What is Sonar? “ Sonar is the central place to manage code quality, offering visual reporting on and across projects and enabling to replay the past to follow metrics evolution” source: http://www.sonarsource.org/
30. Preparing for analysis – pom file <build> <!-- You cannot omit this one, because maven will implicitely add src/main/java to it --> <sourceDirectory> ${basedir}/src/main/php </sourceDirectory> <testSourceDirectory> ${basedir}/src/test </testSourceDirectory> </build>
31. Preparing for analysis – pom file <!-- some properties that you may want to change --> <properties> <sonar.language> php </sonar.language> <sonar.phpPmd.shouldRun> true </sonar.phpPmd.shouldRun> <sonar.phpCodesniffer.shouldRun> true </sonar.phpCodesniffer.shouldRun> <sonar.phpDepend.shouldRun> true </sonar.phpDepend.shouldRun> <sonar.phpUnit.shouldRun> true </sonar.phpUnit.shouldRun> <sonar.phpcpd.shouldRun> true </sonar.phpcpd.shouldRun> </properties>