Code coverage reports with GitHub, Travis and Coveralls
08 June 2013

You have a PHP project hosted on GitHub with continuous integration using Travis-CI?

How about setting up code coverage reports?

For example, here is the code coverage report of PHP-DI: Coverage Status (click on the link to see the details).

To do so, you will need to create an account and enable your project at Coveralls. Then add this to your composer.json:

"require-dev": {
    "satooshi/php-coveralls": "dev-master"

Finally, update your .travis.yml configuration:

language: php

 - 5.3
 - 5.4
 - 5.5

 - wget
 - php composer.phar install --dev --no-interaction

 - mkdir -p build/logs
 - phpunit --coverage-clover build/logs/clover.xml

 - php vendor/bin/coveralls -v

Now if you commit and push, Travis will run the tests and push the code coverage results to Coverall. Check out your project page on Coverall!