PHPCI to Jenkins Plugin

Continuous Integration (CI) has become an essential part of development environments. PHP Developers can make use of PHPCI and/or Jenkins for their CI.

PHPCI is a great tool by Block8, PHPCI provides a very intuitive interface for developers to understand where the solution broke. Especially for code analysis PHPCI is able to link to the Git repository and highlight the code that violated the syntax rule. However when it comes to complex solutions one might find that PHPCI might not provide the required feature.

Jenkins on the other hand has been around for longer and has a large repository of plugins that can become handy. So why not use PHPCI for code analysis and then trigger Jenkins to perform the remaining automation.

The extension at,, is a simple Jenkins integration plugin for PHPCI. When the plugin is installed one can set PHPCI to trigger a Jenkins build.

Setting up the plugin

To setup the plugin upload the Jenkins.php to the PHPCI plugins folder. Note that this requires access to the server.

Once the plugin is installed, create a Jenkins token for the project and assign the token to the project in PHPCI.

Creating a Jenkins Token for the project

  1. Go to the Jenkins Project Page
  2. Navigate to the Project Configuration
  3. Scroll to the section ‘Build Triggers’
  4. Tick the checkbox for ‘Trigger builds remotely (e.g., from scripts)’
  5. In the input box that is shown, put in a Token to refer to the project

Setting up PHPCI configuration to trigger Jenkins build

    1. Go to ‘Edit Project’ for the desired project
    2. In the config section ‘PHPCI build config for this project’
    3. Add a YAML tag for complete. To ensure that the plugin is executed after the tests
    4. Under the complete tag place the ‘jenkins’ tag
    5. For the ‘jenkins’ tag set the following properties:
      1. url – which refers to the Jenkins URL (not the project URL)
      2. project – the name of the project that needs to be triggered after PHPCI tests
      3. token – the token that was created above.
PHPCI Config for Jenkins

PHPCI Config for Jenkins

Save the Jenkins and PHPCI changes and trigger a PHPCI Build. After all tests are executed you should see the ‘jenkins’ plugin executed.

Important Note: The plugin will not fail the build if it does not manage to communicate with Jenkins. Also Jenkins doesn’t provide useful information to determine that the build was successfully triggered so you must perform a manual check when setting up the configuration.