PHPackages                             exussum12/coverage-checker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. exussum12/coverage-checker

ActiveLibrary[Testing &amp; Quality](/categories/testing)

exussum12/coverage-checker
==========================

Allows checking the code coverage of a single pull request

1.1.1(1y ago)1762.6M—3.3%18[3 issues](https://github.com/exussum12/coverageChecker/issues)[1 PRs](https://github.com/exussum12/coverageChecker/pulls)13MITPHPPHP &gt;=8.1

Since Jan 6Pushed 1y ago10 watchersCompare

[ Source](https://github.com/exussum12/coverageChecker)[ Packagist](https://packagist.org/packages/exussum12/coverage-checker)[ RSS](/packages/exussum12-coverage-checker/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (46)Used By (13)

coverageChecker
===============

[](#coveragechecker)

Allows old code to use new standards

[![Build Status](https://camo.githubusercontent.com/3e63832ee28d059d709bb03ff67961bda46765dbb1a122a313e15854ba7fff5d/68747470733a2f2f7472617669732d63692e6f72672f6578757373756d31322f636f766572616765436865636b65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/exussum12/coverageChecker)[![Coverage Status](https://camo.githubusercontent.com/0da6ee338556f4855a91da4320d91fc733096123f371c018e7afb06625e11b3a/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6578757373756d31322f636f766572616765436865636b65722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/exussum12/coverageChecker?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/d0920282ca6f06212fd94be9a1e50bb6dcd1486f4e916573ae37a76eea530ece/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6578757373756d31322f636f766572616765436865636b65722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/exussum12/coverageChecker/?branch=master)

Coverage checker allows new standards to be implemented incrementally, by only enforcing them on new / edited code.

Tools like phpcs and phpmd are an all or nothing approach, coverage checker allows this to work with the diff i.e. enforce all of the pull request / change request.

This is sometimes called "Baselining"

Also working with PHPunit to allow, for example 90% of new/edited code to be covered. which will increase the overall coverage over time.

Installing
==========

[](#installing)

Composer
--------

[](#composer)

With composer simply

```
composer require --dev exussum12/coverage-checker

```

then call the script you need

Using Phar
----------

[](#using-phar)

Phar is a packaged format which should be a single download. The latest Phar can be found [Here](https://github.com/exussum12/coverageChecker/releases).

After downloading run `chmod +x diffFilter.phar` and then call as `./diffFilter.phar` followed by the normal options

Manually
--------

[](#manually)

Clone this repository somewhere your your build plan can be accessed, composer install is preferred but there is a non composer class loader which will be used if composer is not installed. If composer is not used some PHP specific features will not work as expected. Then call the script you need

Usage
=====

[](#usage)

First of all a diff is needed

```
git diff origin/master... > diff.txt

```

See [here](https://github.com/exussum12/coverageChecker/wiki/Generating-a-diff) for a more in depth examples of what diff you should generate

Then the output for the tool you wish to check (such as phpcs, PHPUnit, phpmd etc) for example

```
 phpcs --standard=psr2 --report=json > phpcs.json || true

```

Here the `|| true` ensures that the whole build will not fail if phpcs fails.

Then call diffFilter

```
 ./vendor/bin/diffFilter --phpcs diff.txt phpcs.json 100

```

The last argument (100 in this case) is optional, the default is 100. This can be lowered to 90 for example to ensure that at least 90% of the changed code conforms to the standard. diffFilter will exit with a `0` status if the changed code passes the minimum coverage. `2` otherwise

Extended guide
--------------

[](#extended-guide)

A more in depth guide can be [found on the wiki](https://github.com/exussum12/coverageChecker/wiki) also some tips for speeding up the build.

Installing as a git hook
------------------------

[](#installing-as-a-git-hook)

There are 2 examples hooks in the GitHooks directory, if you symlink to these diffFilter will run locally.

pre-commit is before the commit happens pre-receive will prevent you pushing

Full list of available diff filters
===================================

[](#full-list-of-available-diff-filters)

Below is a list of all tools and a brief description

```
--buddy		Parses buddy (magic number detection) output
--checkstyle	Parses a report in checkstyle format
--clover	Parses text output in clover (xml) format
--codeclimate	Parse codeclimate output
--humbug	Parses the json report format of humbug (mutation testing)
--infecton	Parses the infection text log format
--jacoco	Parses xml coverage report produced by Jacoco
--phan		Parse the default phan(static analysis) output
--phanJson	Parses phan (static analysis) in json format
--phpcpd	Parses the text output from phpcpd (Copy Paste Detect)
--phpcs		Parses the json report format of phpcs, this mode only reports errors as violations
--phpcsStrict	Parses the json report format of phpcs, this mode reports errors and warnings as violations
--phpmd		Parses the xml report format of phpmd, this mode reports multi line violations once per diff, instead of on each line
		the violation occurs
--phpmdStrict	Parses the xml report format of phpmd, this mode reports multi line violations once per line they occur
--phpmnd	Parses the text output of phpmnd (Magic Number Detection)
--phpstan	Parses the text output of phpstan
--phpunit	Parses text output in clover (xml) format generated with coverage-clover=file.xml
--pylint	Parses PyLint output
--psalm		Parses Psalm output

```

Running in information mode
===========================

[](#running-in-information-mode)

Simply pass the 3rd argument in as 0, this will give output showing failed lines but will not fail the build

Why not run the auto fixers
===========================

[](#why-not-run-the-auto-fixers)

Auto fixers do exist for some of these tools, but on larger code bases there are many instances where these can not be auto fixed. CoverageChecker allows to go to these new standards in the most used parts of the code by enforcing all changes to comply to the new standards

What is a diff filtered test
============================

[](#what-is-a-diff-filtered-test)

A diff filtered test is a test where the execution and diffence (diff) is used from a known point. This information can be used to only run the tests which have been changed. Saving in many cases minutes running tests.

A good workflow is to branch, run the tests with `--coverage-php=php-coverage.php` and then when running your tests run `git diff origin/master... > diff.txt && ./composer/bin/phpunit`

This saves the coverage information in the first step which the diff then filters to runnable tests.

This one time effort saves running unnecessary tests on each run, tests for which the code has not changed.

Check the [Wiki](https://github.com/exussum12/coverageChecker/wiki/PHPUnit-or-Clover#speeding-up-builds-with-phpunit) for more information on installation and usage

###  Health Score

56

—

FairBetter than 98% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity59

Moderate usage in the ecosystem

Community32

Small or concentrated contributor base

Maturity85

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 96.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~71 days

Recently: every ~250 days

Total

39

Last Release

692d ago

Major Versions

0.11.0 → 1.0.0-beta2018-12-18

0.11.2 → 1.0.02020-10-27

0.11.3 → 1.0.22022-01-19

PHP version history (3 changes)0.9.0PHP &gt;=5.5

1.0.0-betaPHP &gt;=7.0

1.1.1PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/a7759f1a7acac4ee25112e8e0ac2eb608010aba1060ba00c687d615dc7e74f19?d=identicon)[exussum](/maintainers/exussum)

---

Top Contributors

[![exussum12](https://avatars.githubusercontent.com/u/1102850?v=4)](https://github.com/exussum12 "exussum12 (273 commits)")[![theoboldalex](https://avatars.githubusercontent.com/u/44616505?v=4)](https://github.com/theoboldalex "theoboldalex (2 commits)")[![joereynolds](https://avatars.githubusercontent.com/u/9536682?v=4)](https://github.com/joereynolds "joereynolds (1 commits)")[![Potherca](https://avatars.githubusercontent.com/u/195757?v=4)](https://github.com/Potherca "Potherca (1 commits)")[![richardhughes](https://avatars.githubusercontent.com/u/4634220?v=4)](https://github.com/richardhughes "richardhughes (1 commits)")[![szekely-szabolcs](https://avatars.githubusercontent.com/u/32513270?v=4)](https://github.com/szekely-szabolcs "szekely-szabolcs (1 commits)")[![beattie282](https://avatars.githubusercontent.com/u/3083014?v=4)](https://github.com/beattie282 "beattie282 (1 commits)")[![tomalec](https://avatars.githubusercontent.com/u/17435?v=4)](https://github.com/tomalec "tomalec (1 commits)")[![gpressutto5](https://avatars.githubusercontent.com/u/12385501?v=4)](https://github.com/gpressutto5 "gpressutto5 (1 commits)")

---

Tags

codeclimatecoveragedifffilterhacktoberfestjacocophanphpphpcsphpmdphpstanphpunitpylintqaqualityquality-controlstandalone-php-librarystandard-conformstandardsstatic-code-analysis

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/exussum12-coverage-checker/health.svg)

```
[![Health](https://phpackages.com/badges/exussum12-coverage-checker/health.svg)](https://phpackages.com/packages/exussum12-coverage-checker)
```

###  Alternatives

[phpunit/php-code-coverage

Library that provides collection, processing, and rendering functionality for PHP code coverage information.

8.9k892.4M1.5k](/packages/phpunit-php-code-coverage)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[behat/behat

Scenario-oriented BDD framework for PHP

4.0k96.8M2.0k](/packages/behat-behat)[infection/infection

Infection is a Mutation Testing framework for PHP. The mutation adequacy score can be used to measure the effectiveness of a test set in terms of its ability to detect faults.

2.2k26.2M1.8k](/packages/infection-infection)[sebastian/complexity

Library for calculating the complexity of PHP code units

1.3k528.8M12](/packages/sebastian-complexity)[sebastian/lines-of-code

Library for counting the lines of code in PHP source code

1.2k528.9M13](/packages/sebastian-lines-of-code)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
