phpcov is a command-line frontend for the php-code-coverage library.
The recommended way to use this tool is a PHP Archive (PHAR):
$ wget https://phar.phpunit.de/phpcov.phar
$ php phpcov.phar --version
Furthermore, it is recommended to use Phive for installing and updating the tool dependencies of your project.
Alternatively, you may use Composer to download and install this tool as well as its dependencies. This is not recommended, though.
$ phpcov execute --clover coverage.xml script.php
phpcov 8.1.0 by Sebastian Bergmann.
Generating code coverage report in Clover XML format ... done
$ parallel --gnu ::: \
'phpunit --coverage-php /tmp/coverage/FooTest.cov tests/FooTest' \
'phpunit --coverage-php /tmp/coverage/BarTest.cov tests/BarTest'
$ phpcov merge --clover /tmp/clover.xml /tmp/coverage
phpcov 8.1.0 by Sebastian Bergmann.
Generating code coverage report in Clover XML format ... done
$ git diff HEAD^1 > /tmp/patch.txt
$ phpunit --coverage-php /tmp/coverage.cov
$ phpcov patch-coverage --path-prefix /path/to/project /tmp/coverage.cov /tmp/patch.txt
phpcov 8.1.0 by Sebastian Bergmann.
1 / 2 changed executable lines covered (50.00%)
Changed executable lines that are not covered:
Example.php:11