PHPackages                             magician79/php-coverage-tools - 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. magician79/php-coverage-tools

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

magician79/php-coverage-tools
=============================

CLI tools for normalizing PHP coverage reports by removing non-executable files

v0.2.1(4mo ago)039MITPHPPHP &gt;=8.3CI passing

Since Dec 26Pushed 4mo agoCompare

[ Source](https://github.com/magician79/php-coverage-tools)[ Packagist](https://packagist.org/packages/magician79/php-coverage-tools)[ RSS](/packages/magician79-php-coverage-tools/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (6)Used By (0)

php-coverage-tools
==================

[](#php-coverage-tools)

[![CI](https://github.com/magician79/php-coverage-tools/actions/workflows/ci.yml/badge.svg)](https://github.com/magician79/php-coverage-tools/actions/workflows/ci.yml)

Small, explicit CLI utilities for normalizing PHP coverage reports.

---

Why
---

[](#why)

Cobertura and similar coverage formats correctly include **interfaces and pure contracts** in their reports. These elements contain no executable code.

Many coverage summary tools, however, treat these entries as **0% covered files**, which pollutes coverage metrics and causes misleading regressions.

This package enforces a simple rule:

> **Non-executable code must not affect coverage health.**

---

Tooling
-------

[](#tooling)

### `filter-cobertura`

[](#filter-cobertura)

Filters **non-executable packages** from a Cobertura XML report.

A package is considered *non-executable* when all of the following are true:

- `line-rate` is `0`
- `complexity` is `0`
- It contains **no executable `` elements**
- It represents an empty `` structure (typical for interfaces)

This logic matches Cobertura output observed in real-world reports and is validated by unit tests.

Executable packages and *mixed packages* (for example, partially covered code) are preserved defensively.

---

Usage
-----

[](#usage)

```
filter-cobertura input.xml output.xml
```

The resulting file contains **only executable coverage data** and can safely be used for coverage summaries, CI thresholds, and badges.

If a non-executable package leaks through after filtering, the tool fails fast with a clear error instead of silently producing incorrect metrics.

---

Guarantees
----------

[](#guarantees)

- Executable packages are **never removed**
- Mixed or ambiguous packages are **preserved**
- Pure non-executable packages are **excluded**
- Behavior is enforced by **unit tests**

---

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

[](#installation)

Install as a development dependency:

```
composer require magician79/php-coverage-tools
```

> This package is intended for CI and development workflows and should not be installed in production dependencies.

---

Typical CI usage
----------------

[](#typical-ci-usage)

```
vendor/bin/filter-cobertura \
  coverage/cobertura.xml \
  coverage/cobertura.filtered.xml
```

Use the filtered report for coverage summaries and badges.

---

License
-------

[](#license)

MIT

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance74

Regular maintenance activity

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

5

Last Release

142d ago

### Community

Maintainers

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

---

Top Contributors

[![magician79](https://avatars.githubusercontent.com/u/9150976?v=4)](https://github.com/magician79 "magician79 (16 commits)")

---

Tags

phptestingcoveragecicobertura

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/magician79-php-coverage-tools/health.svg)

```
[![Health](https://phpackages.com/badges/magician79-php-coverage-tools/health.svg)](https://phpackages.com/packages/magician79-php-coverage-tools)
```

###  Alternatives

[rregeer/phpunit-coverage-check

Check the code coverage using the clover report of phpunit

606.1M179](/packages/rregeer-phpunit-coverage-check)[quizlet/hammock

Hammock is a stand-alone mocking library for Hacklang.

27445.5k](/packages/quizlet-hammock)[doppiogancio/mocked-client

A simple way to mock a client

2174.9k3](/packages/doppiogancio-mocked-client)

PHPackages © 2026

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