Writings of this and that.

Mostly tech, but sometimes comments about the 'analog' world.


checkstyle2redmine – Create issues in Redmine from PHP_CodeSniffer

Download from github.

Tools like PHP_CodeSniffer check your PHP code for compliance with various coding standards. PHP_CodeSniffer can write the results to a XML file.

checkstyle2redmine reads this output file and creates a new issue for every error in Redmine.


  1. Create a directory (e.g. c2r) on your development system.
  2. Download checkstyle2redmine.php and put it into a the directory
  3. checkstyle2redmine uses the ActiveResource library which can be found here on github. Download ActiveResource.php and put it into the directory you created above.
  4. Make checkstyle2redmine.php executable.

Redmine integration

checkstyle2redmine uses the REST API provided by Redmine since version 1.0. Check the Redmine docu on this topic. In short:

  1. Enable the REST API in your Redmine frontend: Administration -> Settings -> Authentication
  2. Get the API key for the Redmine user. You can find your API key on your account page ( /my/account ) when logged in, on the right-hand pane of the default layout.1


Generic call of the script:

checkstyle2redmine.php --file=out.xml --host=URL --API=API_KEY --project=PROJECT_SHORT


Assume the following:

Then the call would be:

checkstyle2redmine.php --file=checkstyle.xml --host= --API=API_KEY --project=ABCD

Note the trailing slash for the host parameter!

  1. In my setup, I created a special user “Style Reporter” for the generated issues with the ‘Reporter’ role.