Code coverage reports with GitHub, Travis and Coveralls

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

php:
 - 5.3
 - 5.4
 - 5.5

before_script:
 - wget http://getcomposer.org/composer.phar
 - php composer.phar install --dev --no-interaction

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

after_script:
 - 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!