PHPackages                             rregeer/phpunit-coverage-check - 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. rregeer/phpunit-coverage-check

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

rregeer/phpunit-coverage-check
==============================

Check the code coverage using the clover report of phpunit

0.3.1(6y ago)606.1M—8.8%15[2 issues](https://github.com/richardregeer/phpunit-coverage-check/issues)[2 PRs](https://github.com/richardregeer/phpunit-coverage-check/pulls)20MITPHPPHP &gt;=7.0.0

Since May 9Pushed 2y ago4 watchersCompare

[ Source](https://github.com/richardregeer/phpunit-coverage-check)[ Packagist](https://packagist.org/packages/rregeer/phpunit-coverage-check)[ RSS](/packages/rregeer-phpunit-coverage-check/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)DependenciesVersions (12)Used By (20)

[![Build Status](https://camo.githubusercontent.com/52866c2067c04792858d0b7d4600797f0c32dfbb7e97f541688f2014d860cae4/68747470733a2f2f7472617669732d63692e6f72672f726963686172647265676565722f706870756e69742d636f7665726167652d636865636b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/richardregeer/phpunit-coverage-check)

phpunit-coverage-check
======================

[](#phpunit-coverage-check)

This php script will read the clover xml report from phpunit and calculates the coverage score. Based on the given threshold the script will exit ok of the coverage is higher then the threshold or exit with code 1 if the coverage is lower then the threshold. This script can be used in your continuous deployment environment or for example added to a pre-commit hook.

Installation
============

[](#installation)

The script can be installed using composer. Add this repository as a dependency to the composer.json file.

```
composer require --dev rregeer/phpunit-coverage-check
```

Usage
=====

[](#usage)

The script has requires 2 parameters that are mandatory to return the code coverage.

1. The location of the clover xml file, that's generated by phpunit.
2. The coverage threshold that is acceptable. Min = 1, Max = 100

Generate the `clover.xml` file by using phpunit and run the coverage check script: Run the script:

```
vendor/bin/phpunit --coverage-clover clover.xml
vendor/bin/coverage-check clover.xml 80
vendor/bin/coverage-check clover.xml 80 --only-percentage
```

With the `--only-percentage` enabled, the CLI command will only return the resulting coverage percentage.

It's also possible to add the coverage report generation to the `phpunit.xml.dist` add to following lines to the xml file inside the `` tag:

```

```

For more information see the [phpunit documentation](https://phpunit.readthedocs.io/en/9.5/). Information about the [configuration file](https://phpunit.readthedocs.io/en/9.5/configuration.html) and [commandline options](https://phpunit.readthedocs.io/en/9.5/textui.html#command-line-options).

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity58

Moderate usage in the ecosystem

Community37

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~156 days

Recently: every ~110 days

Total

9

Last Release

2409d ago

PHP version history (2 changes)0.1.0PHP &gt;=5.5.0

0.2.0PHP &gt;=7.0.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/8b17aecaa0adf47359fc7b7e752400fca939f25fc0234b51b768c20cca4dc974?d=identicon)[r.regeer](/maintainers/r.regeer)

---

Top Contributors

[![richardregeer](https://avatars.githubusercontent.com/u/16963508?v=4)](https://github.com/richardregeer "richardregeer (15 commits)")[![rregeer](https://avatars.githubusercontent.com/u/4814166?v=4)](https://github.com/rregeer "rregeer (8 commits)")[![Krinkle](https://avatars.githubusercontent.com/u/156867?v=4)](https://github.com/Krinkle "Krinkle (3 commits)")[![ttomdewit](https://avatars.githubusercontent.com/u/2845400?v=4)](https://github.com/ttomdewit "ttomdewit (3 commits)")[![sanmai](https://avatars.githubusercontent.com/u/139488?v=4)](https://github.com/sanmai "sanmai (2 commits)")[![n0nag0n](https://avatars.githubusercontent.com/u/2322095?v=4)](https://github.com/n0nag0n "n0nag0n (1 commits)")

---

Tags

phptestingphpunitciunittestcode coverage

### Embed Badge

![Health badge](/badges/rregeer-phpunit-coverage-check/health.svg)

```
[![Health](https://phpackages.com/badges/rregeer-phpunit-coverage-check/health.svg)](https://phpackages.com/packages/rregeer-phpunit-coverage-check)
```

###  Alternatives

[robiningelbrecht/phpunit-coverage-tools

PHPUnit coverage tools

1783.0k34](/packages/robiningelbrecht-phpunit-coverage-tools)[friendsofcake/fixturize

CakePHP Fixture classes to help increase productivity or performance

24504.7k1](/packages/friendsofcake-fixturize)[hot/phpunit-runner

The lib allows to watch phpunit tests

3066.9k4](/packages/hot-phpunit-runner)

PHPackages © 2026

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