November 28, 2014 / by Daniel Huchthausen / In Technology

PHP meets SCM-Manager Universe

+++This post was migrated from our former blog about SCM-Manager Universe. Therefore, the design is slightly different and some information might not be 100% applicable to Cloudogu EcoSystem. So don't be alarmed; enjoy reading.+++

To keep SCM-Manager Universe as lean as possible the appliance is geared for Java projects. To use it with some of the other programming languages it is necessary to perform some modifications. We want to show you how to adjust your SCM-Manager Universe for PHP projects.

Basic Modifications

To use SCM-Manager Universe for your PHP projects you only need to perform small changes to your appliance. For a start you need to install the PHP plugin for SonarQube and you need to provide a properties file for each project you want to perform a code analysis for. If you want to implement unit testing in Jenkins you need to configure some shell execution commands to the build process.

SonarQube Configuration

First of all you can install the PHP plugin in SonarQube. Go to the Update Center screen “Settings → System → Update Center”, select the Available Plugins tab and search for PHP. Click on Install. After the successful installation and a reload of the application you can see the plugin in the Installed Plugins screen.

The plugin implements coding rules specifically for PHP projects. The rules are used automatically every time a PHP project gets analyzed.

Jenkins - SonarQube Configuration

After SonarQube was prepared for PHP projects you can add a new Jenkins job for your PHP project (e.g. as “Freestyle Project”) and add the necessary configuration. Firstly you can add a SonarQube analysis to the build.

In addition to that you need a file in the top folder of your project. This file is required by SonarRunner to start the analysis. Before you can use it for your project, you need to adjust the file to your project.





# Reusing PHPUnit reports

The file contains information like the language, encoding and paths to reports and unit tests. It ensures that SonarQube uses the previously installed PHP plugin. In this example there are no unit tests executed by SonarQube, because the row “sonar.tests” is commented out.

Now the configuration of SonarQube is done. The only thing left to do is to enable Jenkins to build your project and to perform your unit tests.

Build and Unit Testing

To build PHP projects with Jenkins you need a PHP build system. In this example we use Phing. For unit tests we use PHPunit. To keep your build and test system variable you can use the dependency management tool Composer. The implementation of those three tools in Jenkins is easy. You only need to add three shell commands to the build execution:

The first command installs Composer, the second one looks for updates and downloads the dependencies, the third one executes the build with Phing. Composer requires a Composer.json file in the top folder of your project that contains the dependencies of the project. This file could look like this:

It contains the requirements of the project including for example Phing and PHPunit. Each requirement consists of the vendor name, the project name and the version. You can use a local installation of Composer to generate the composer.json file.

Phing uses the build.xml of the project to execute the build and PHPunit will be used to execute the unit tests.

If you start a new project and you want to use the latest versions of the tools, you only need to adjust the versions in the composer.json file.


The benefit from using Composer with Jenkins is that the time for setting up the infrastructure is reduced and the requirements are very variable, because Composer installs all required dependencies automatically. SCM-Manager Universe can be modified to meet the requirements for PHP projects quite fast and without complicated installations or modifications. Depending on the frameworks you are using the implementation can be a bit different.

With kind regards,
your SCM-Manager Universe Team

Daniel Huchthausen

- Consultant -

When he is not exploring the wilderness, Daniel keeps himself busy with topics such as quality assurance, testing and PM methods.

©2018 Cloudogu GmbH. All rights reserved. Legal Notice | Privacy Policy

Cloudogu™, Cloudogu EcoSystem™ and the Cloudogu™ logo are registered trademarks of Cloudogu GmbH, Germany.