PHPackages                             digitalrevolution/phpunit-file-coverage-inspection - 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. digitalrevolution/phpunit-file-coverage-inspection

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

digitalrevolution/phpunit-file-coverage-inspection
==================================================

Configurable phpunit file coverage inspection

v3.1.0(6mo ago)5173.4k↑74%2[1 issues](https://github.com/123inkt/phpunit-file-coverage-inspection/issues)[2 PRs](https://github.com/123inkt/phpunit-file-coverage-inspection/pulls)12MITPHPPHP &gt;=8.1CI passing

Since Sep 18Pushed 2w ago1 watchersCompare

[ Source](https://github.com/123inkt/phpunit-file-coverage-inspection)[ Packagist](https://packagist.org/packages/digitalrevolution/phpunit-file-coverage-inspection)[ RSS](/packages/digitalrevolution-phpunit-file-coverage-inspection/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (10)Versions (23)Used By (12)

[![Minimum PHP Version](https://camo.githubusercontent.com/230588f62e4b3ba29858fcfcf1bbfe253f82c4180088091d6c7d4c6c06d80145/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230382e312d383839324246)](https://php.net/)[![Run tests](https://github.com/123inkt/phpunit-file-coverage-inspection/actions/workflows/test.yml/badge.svg)](https://github.com/123inkt/phpunit-file-coverage-inspection/actions/workflows/test.yml/badge.svg)

PHPUnit coverage inspection
===========================

[](#phpunit-coverage-inspection)

A tool to allow code coverage rules be defined per file. Set a minimum coverage threshold for every file and configure custom minimum coverage for existing files if the current test coverage is not up to standards yet. Inspection failure will be output in checkstyle format, allowing it to be imported in ci/cd tools.

Use case
--------

[](#use-case)

Standard coverage calculation is calculated over the whole codebase. If for example the threshold is 80% and one file drops below 80% you never notice this because the overall coverage went from 87.6% to 87.4%. This package makes sure that that doesn't happen anymore and coverage is calculated on a per-file basis.

Supported formats
-----------------

[](#supported-formats)

- Input: clover coverage.xml
- Output: checkstyle or gitlab

Installation
------------

[](#installation)

Include the library as dependency in your own project via:

```
composer require "digitalrevolution/phpunit-file-coverage-inspection" --dev

```

Configuration
-------------

[](#configuration)

File: `phpfci.xml`

```

```

OptionRequiredDefaultDescriptionmin-coverageyes-The minimum global coverageallow-uncovered-methodsnofalseAll methods should have atleast some coverageor generate a config file based on existing coverage results

```
php vendor/bin/phpfci baseline coverage.xml --config ./phpfci.xml --baseDir /home/ci/workspace
php vendor/bin/phpfci baseline coverage1.xml coverage2.xml --config ./phpfci.xml --baseDir /home/ci/workspace
```

The base directory will be subtracted from the filepaths in coverage.xml

Usage
-----

[](#usage)

Checkstyle format:

```
php vendor/bin/phpfci inspect coverage.xml --reportCheckstyle=reports/checkstyle.xml
```

Gitlab format:

```
php vendor/bin/phpfci inspect coverage.xml --reportGitlab=reports/gitlab.errors.json
```

Gitlab format to file and text output to stdout:

```
php vendor/bin/phpfci inspect coverage.xml --reportGitlab=reports/gitlab.errors.json --reportText
```

Text format to stdout:

```
php vendor/bin/phpfci inspect coverage.xml
php vendor/bin/phpfci inspect coverage1.xml coverage2.xml
```

```
php vendor/bin/phpfci inspect coverage.xml --reportText
```

Command line arguments
----------------------

[](#command-line-arguments)

OptionValuesDescription`argument 1``inspect`, `baseline`the command to execute.`argument 2` \[`argument 3`\]...`coverage.xml` \[`coverage2.xml`\]the phpunit clover coverage input file(s).`--reportGitlab=[]`filepath or if absent stdoutthe file (or stdout) to write the gitlab format to.`--reportCheckstyle=[]`filepath or if absent stdoutthe file (or stdout) to write the checkstyle format to.`--reportText=[]`filepath or if absent stdoutthe file (or stdout) to write the checkstyle format to.`--config=``phpfci.xml`the path to the config file.`--baseDir=`defaults to directory of the output fileThe root directory of the project, will be used to make paths relative.`--exit-code-on-failure`-Set exit code to `1` when there are failures.Note: if no `--reportGitlab`, `--reportCheckstyle` or `--reportText` is set, it will default to `--reportText=php://stdout`

Migrating from 1 to 2
---------------------

[](#migrating-from-1-to-2)

The third required argument and `--report` has been removed, and should be replaced by: `--reportGitlab=`, `--reportCheckstyle=` or `--reportText=`

Migrating from 2 to 3
=====================

[](#migrating-from-2-to-3)

The baseline now also supports multiple coverage files, as the inspect command. An error is also raised if the baseline custom entry doesn't match the coverage.

About us
--------

[](#about-us)

At 123inkt (Part of Digital Revolution B.V.), every day more than 50 development professionals are working on improving our internal ERP and our several shops. Do you want to join us? [We are looking for developers](https://www.werkenbij123inkt.nl/zoek-op-afdeling/it).

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance80

Actively maintained with recent releases

Popularity38

Limited adoption so far

Community26

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 79.2% 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 ~101 days

Recently: every ~77 days

Total

20

Last Release

187d ago

Major Versions

v1.6.0 → v2.0.02023-03-28

v2.2.2 → v3.0.02025-02-21

PHP version history (4 changes)v1.0.0PHP 7.2.\* || 7.3.\* || 7.4.\*

v1.1.0PHP &gt;=7.2

v1.1.1PHP &gt;=7.4

v2.1.0PHP &gt;=8.1

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/20e2ae81f6cffdb8c1b1a488b7f2f70270a5d1bf2a57aae09950697ac0ef3dad?d=identicon)[123Tim](/maintainers/123Tim)

---

Top Contributors

[![frankdekker](https://avatars.githubusercontent.com/u/2179983?v=4)](https://github.com/frankdekker "frankdekker (168 commits)")[![anne-gaelle123inkt](https://avatars.githubusercontent.com/u/50699909?v=4)](https://github.com/anne-gaelle123inkt "anne-gaelle123inkt (26 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (10 commits)")[![bram123](https://avatars.githubusercontent.com/u/7457368?v=4)](https://github.com/bram123 "bram123 (4 commits)")[![PrinsFrank](https://avatars.githubusercontent.com/u/25006490?v=4)](https://github.com/PrinsFrank "PrinsFrank (3 commits)")[![RubenKluft](https://avatars.githubusercontent.com/u/212696652?v=4)](https://github.com/RubenKluft "RubenKluft (1 commits)")

---

Tags

automationcoding-standardscoveragephpphpunittesttesting-tools

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/digitalrevolution-phpunit-file-coverage-inspection/health.svg)

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

###  Alternatives

[testo/testo

A lightweight PHP testing framework.

1959.3k64](/packages/testo-testo)

PHPackages © 2026

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