PHPackages                             julianseeger/php-real-coverage - 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. julianseeger/php-real-coverage

ActiveLibrary

julianseeger/php-real-coverage
==============================

Calculate the real coverage based on an existing php-code-coverage report

3251PHP

Since Mar 13Pushed 12y ago3 watchersCompare

[ Source](https://github.com/julianseeger/php-real-coverage)[ Packagist](https://packagist.org/packages/julianseeger/php-real-coverage)[ RSS](/packages/julianseeger-php-real-coverage/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![Build Status](https://camo.githubusercontent.com/bee5946a1caf45fb97ef907ac4fb669c4d744dbecb1832f36913d0e71ba3bb00/68747470733a2f2f7472617669732d63692e6f72672f6a756c69616e7365656765722f7068702d7265616c2d636f7665726167652e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/julianseeger/php-real-coverage)[![Code Coverage](https://camo.githubusercontent.com/a542daf0869c99cadb5737bf294c1450f25c3404fceb12dce09614fcd22eecc2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a756c69616e7365656765722f7068702d7265616c2d636f7665726167652f6261646765732f636f7665726167652e706e673f733d31653032343131323931316466313631383236643632373036323663663430396630306638343535)](https://scrutinizer-ci.com/g/julianseeger/php-real-coverage/)[![Scrutinizer Quality Score](https://camo.githubusercontent.com/0b1a7bdbe7a4cdd1399b6230dddbc3e3d98147ad39a9031cec1f35d65045c536/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a756c69616e7365656765722f7068702d7265616c2d636f7665726167652f6261646765732f7175616c6974792d73636f72652e706e673f733d63306435393165353936666334386237323862343636353439363964303063646365653962336438)](https://scrutinizer-ci.com/g/julianseeger/php-real-coverage/)[![License](https://camo.githubusercontent.com/e72503843d1d41a48430abeaf7895412ec2b9190213df74ccc1cde977f4089ec/68747470733a2f2f706f7365722e707567782e6f72672f6a756c69616e7365656765722f7068702d7265616c2d636f7665726167652f6c6963656e73652e706e67)](https://packagist.org/packages/julianseeger/php-real-coverage)[![Latest Stable Version](https://camo.githubusercontent.com/c6e785560bf53e0520fbe16b0c16f082365bba607636ce06283fc4ca110fca14/68747470733a2f2f706f7365722e707567782e6f72672f6a756c69616e7365656765722f7068702d7265616c2d636f7665726167652f762f737461626c652e706e67)](https://packagist.org/packages/julianseeger/php-real-coverage)

What is "real" coverage?
========================

[](#what-is-real-coverage)

Given you have a simple class

```
class SomeClass
{
    public function someFunction()
    {
        $instance = "important message";    // this line is important
        $a = "This code";
        $b = "is completely";
        $c = "usesless";
        $instance .= "!!!";                 // this one is important too
        if (true) {
            $f = "and has";
            $g = "100% coverage";
        }
        $c .= "!";
        return $instance;                   // and this one is important
    }
}
```

And a pretty useless test for this class, that leaves most of the behavior untested

```
class SomeClassTest extends \PHPUnit_Framework_TestCase
{
    public function testThisTestIsStupid()
    {
        $sut = new SomeClass();
        $instance = $sut->someFunction();

        $this->assertEquals("important message!!!", $instance);
    }
}
```

But nevertheless, the test produces 100% coverage for this class

[![](https://camo.githubusercontent.com/6945f5caaa83b792fea0d662b0895e7f99ed24be24702350835da37b3af36189/68747470733a2f2f7261772e6769746875622e636f6d2f6a756c69616e7365656765722f7068702d7265616c2d636f7665726167652f6d61737465722f726561646d652d7265736f75726365732f756e7265616c2d636f7665726167652e706e67)](https://camo.githubusercontent.com/6945f5caaa83b792fea0d662b0895e7f99ed24be24702350835da37b3af36189/68747470733a2f2f7261772e6769746875622e636f6d2f6a756c69616e7365656765722f7068702d7265616c2d636f7665726167652f6d61737465722f726561646d652d7265736f75726365732f756e7265616c2d636f7665726167652e706e67)

When you run **php-real-coverage** on this project

Then you will know, what lines are actually tested

[![](https://camo.githubusercontent.com/b15e2b9c9a5ca5c7e8ca86df81ae01c1f7e2a99a5ab37bf088ff7628b4fa33b9/68747470733a2f2f7261772e6769746875622e636f6d2f6a756c69616e7365656765722f7068702d7265616c2d636f7665726167652f6d61737465722f726561646d652d7265736f75726365732f7265616c2d636f7665726167652e706e67)](https://camo.githubusercontent.com/b15e2b9c9a5ca5c7e8ca86df81ae01c1f7e2a99a5ab37bf088ff7628b4fa33b9/68747470733a2f2f7261772e6769746875622e636f6d2f6a756c69616e7365656765722f7068702d7265616c2d636f7665726167652f6d61737465722f726561646d652d7265736f75726365732f7265616c2d636f7665726167652e706e67)

In this example, only line 8, 12 and 18 are neccessary to make the test pass.

QuickStart
==========

[](#quickstart)

Add it to your composer.json

```
"require-dev": {
    "julianseeger/php-real-coverage": "*"
}

```

Generate a coverage-report with phpunit

```
./vendor/bin/phpunit --coverage-php coverage.php

```

And let php-real-coverage test the quality of your coverage

```
./vendor/bin/php-real-coverage coverage.php

```

Roadmap to Version 0.1-Beta
===========================

[](#roadmap-to-version-01-beta)

- add proxy-autoloader
- handle non-composer autoloader (wrap existing autoloaders)
- keep original method signature in the polymorphic proxies (strict support)
- allow non-namespaced classes
- support for magic methods
- rewrite the prototype of RealCoverageRun (the "main" method)
- pass appropriate arguments to phpunit
- support bootstrapping (like "--bootstrap" in phpunit)

Roadmap to Version 1.0
======================

[](#roadmap-to-version-10)

- integrate symfony/console
- run only those tests that cover the modified lines (huge speedup)
- add hooks into main algorithm to allow listeners/printers/etc
- support all default phpunit coverage writers (html, text, clover, php)
- review and restructure the architecture

Limitations
===========

[](#limitations)

- only works with phpunit

> looking forward to extend it for other frameworks, given there is an audience for it

- no support for phpunit 4

> as soon as phpunit 4 is stable, I will integrate support for phpunit 3 and 4 simultanuously

- maybe you will run into problems when you abuse reflections or dynamic loading in your project, so php-real-coverage probably won't work for doctrine, etc. But it is basically meant for straight-forward test-driven projects
- no support for hhvm

> I'm currently lacking any experience with hhvm, but as it seems to support phpunit I'm looking forward to change this.

Contribute
==========

[](#contribute)

Execute the tests

```
composer install --prefer-dist --dev
./vendor/bin/phpunit

```

Make your changes tested and in PSR-2

Execute the the tests again

And make your Pull Request

PS: The build will fail if the testcoverage falls below 100%

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.4% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/4b9bd106d4e962d06556ce3dc646cec94b63fc19695ccd38887199533209aa94?d=identicon)[julianseeger](/maintainers/julianseeger)

---

Top Contributors

[![julianseeger](https://avatars.githubusercontent.com/u/3258762?v=4)](https://github.com/julianseeger "julianseeger (150 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (4 commits)")

### Embed Badge

![Health badge](/badges/julianseeger-php-real-coverage/health.svg)

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

PHPackages © 2026

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