PHPackages                             dragonrun1/phpspec-code-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. [Testing &amp; Quality](/categories/testing)
4. /
5. dragonrun1/phpspec-code-coverage

Abandoned → [friends-of-phpspec/phpspec-code-coverage](/?search=friends-of-phpspec%2Fphpspec-code-coverage)Library[Testing &amp; Quality](/categories/testing)

dragonrun1/phpspec-code-coverage
================================

Generate Code Coverage reports for PhpSpec tests

4.2.3(7y ago)017.0k2MITPHPPHP ^7.1

Since Feb 11Pushed 6y ago2 watchersCompare

[ Source](https://github.com/Dragonrun1/phpspec-code-coverage)[ Packagist](https://packagist.org/packages/dragonrun1/phpspec-code-coverage)[ Docs](https://github.com/leanphp/phpspec-code-coverage)[ RSS](/packages/dragonrun1-phpspec-code-coverage/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (4)Versions (16)Used By (0)

phpspec-code-coverage
=====================

[](#phpspec-code-coverage)

[![License](https://camo.githubusercontent.com/48e383d2220a05be2c5994fc7ea9f4a8df23e48d118388b78ad8786ef40cb7f9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c65616e7068702f706870737065632d636f64652d636f7665726167652e7376673f7374796c653d666c61742d737175617265)](#LICENSE)[![Latest Stable Version](https://camo.githubusercontent.com/757834f5b0ed89e79861dec7ccf36638e451b1e581754c18bfce6f3588913605/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c65616e7068702f706870737065632d636f64652d636f7665726167652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/leanphp/phpspec-code-coverage)[![Total Downloads](https://camo.githubusercontent.com/2fab119c2dc6af0a6ad027c0f38bfdb894e93b906c4d1bb5d440b1cdd55096d5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c65616e7068702f706870737065632d636f64652d636f7665726167652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/leanphp/phpspec-code-coverage)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/e6da796f24ff985ce9da3324a531a7bf26eaa90f91626dbfbf9e6909b246a67e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c65616e7068702f706870737065632d636f64652d636f7665726167652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/leanphp/phpspec-code-coverage/?branch=master)[![Travis](https://camo.githubusercontent.com/6f811021a687faf7ac0bf74436708fb528249c404c23cde88c88b80bfdf6cd9d/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6c65616e7068702f706870737065632d636f64652d636f7665726167652e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/leanphp/phpspec-code-coverage)[![AppVeyor](https://camo.githubusercontent.com/9e6ab65a4cbdebc933661615fa9c0b57e97f01455780dec4ff40ab5ba3e2bd5f/68747470733a2f2f696d672e736869656c64732e696f2f6170707665796f722f63692f6c65616e7068702f706870737065632d636f64652d636f7665726167652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://ci.appveyor.com/project/leanphp/phpspec-code-coverage)

[phpspec-code-coverage](https://github.com/leanphp/phpspec-code-coverage) is a [PhpSpec](http://www.phpspec.net/en/stable) extension that generates Code Coverage reports for [PhpSpec](http://www.phpspec.net/en/stable) tests.

Generating Code Coverage reports allows you to to analyze which parts of your codebase are tested and how well. However, Code Coverage alone should NOT be used as a single metric defining how good your tests are.

**Note!** This is a maintained fork of [henrikbjorn/phpspec-code-coverage](https://github.com/henrikbjorn/PhpSpecCodeCoverageExtension)package with compatible version numbers for stable releases.

```
composer require --dev dragonrun1/phpspec-code-coverage

```

[![phpspec-code-coverage console report](https://camo.githubusercontent.com/22dabff92dd18b7366b737cf95e0189f191804a4fa4099bafb753926bac2228a/68747470733a2f2f692e696d6775722e636f6d2f425531305a41562e706e67)](https://camo.githubusercontent.com/22dabff92dd18b7366b737cf95e0189f191804a4fa4099bafb753926bac2228a/68747470733a2f2f692e696d6775722e636f6d2f425531305a41562e706e67)[![phpspec-code-coverage HTML report](https://camo.githubusercontent.com/442573a9c79d1cbaf0fa7f381cc4fcec7e7ec277af62ee32c99fb8f70e36e7d2/68747470733a2f2f692e696d6775722e636f6d2f367841435231672e706e67)](https://camo.githubusercontent.com/442573a9c79d1cbaf0fa7f381cc4fcec7e7ec277af62ee32c99fb8f70e36e7d2/68747470733a2f2f692e696d6775722e636f6d2f367841435231672e706e67)

Requirements
------------

[](#requirements)

- PHP 7+ (for [PhpSpec](http://www.phpspec.net/en/stable) v4+) or PHP 5.6+ (for [PhpSpec](http://www.phpspec.net/en/stable) v3)
- [Xdebug](https://xdebug.org/) or [phpdbg](https://github.com/krakjoe/phpdbg) extension enabled (PHP 7+ is required for code generation to work with [phpdbg](https://github.com/krakjoe/phpdbg)).

Change Log
----------

[](#change-log)

Please see [CHANGELOG.md](CHANGELOG.md) for information on recent changes.

Install
-------

[](#install)

Install this package as a development dependency in your project:

```
$ composer require --dev dragonrun1/phpspec-code-coverage

```

Enable extension by editing `phpspec.yml` of your project:

```
extensions:
  LeanPHP\PhpSpec\CodeCoverage\CodeCoverageExtension: ~
```

This will sufficient to enable Code Coverage generation by using defaults provided by the extension. This extension supports various [configuration options](#Options). For a fully annotated example configuration file check [Configuration section](#Configuration).

Usage
-----

[](#usage)

If you execute `phpspec run` command, you will see code coverage generated in `coverage` directory (in `html` format):

```
$ bin/phpspec run

```

**Note!** When generating Code Coverage reports make sure PHP processes run via CLI are not memory limited (i.e. `memory_limit` set to `-1` in `/etc/php/cli/php.ini`).

### Running with phpdbg

[](#running-with-phpdbg)

This extension now supports [phpdbg](https://github.com/krakjoe/phpdbg), which results in faster execution when using more recent versions of PHP. Run `phpspec` via [phpdbg](https://github.com/krakjoe/phpdbg):

```
$ phpdbg -qrr phpspec run

```

**Note!** PHP 7+ is required for code generation to work with [phpdbg](https://github.com/krakjoe/phpdbg).

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

[](#configuration)

You can see fully annotated `phpspec.yml` example file below, which can be used as a starting point to further customize the defaults of the extension. The configuration file below has all of the [Configuration Options](#Options).

```
# phpspec.yml
# ...
extensions:
  # ... other extensions ...
  # leanphp/phpspec-code-coverage
  LeanPHP\PhpSpec\CodeCoverage\CodeCoverageExtension:
    # Specify a list of formats in which code coverage report should be
    # generated.
    # Default: [html]
    format:
      - text
      - html
      #- clover
      #- php
      #- xml
    #
    # Specify output file/directory where code coverage report will be
    # generated. You can configure different output file/directory per
    # enabled format.
    # Default: coverage
    output:
      html: coverage
      #clover: coverage.xml
      #php: coverage.php
      #xml: coverage
    #
    # Should uncovered files be included in the reports?
    # Default: true
    #show_uncovered_files: true
    #
    # Set lower upper bound for code coverage
    # Default: 35
    #lower_upper_bound: 35
    #
    # Set high lower bound for code coverage
    # Default: 70
    #high_lower_bound: 70
    #
    # Whilelist directories for which code generation should be done
    # Default: [src, lib]
    #
    whitelist:
      - src
      - lib
    #
    # Whiltelist files for which code generation should be done
    # Default: empty
    #whilelist_files:
      #- app/bootstrap.php
      #- web/index.php
    #
    # Blacklist directories for which code generation should NOT be done
    #blacklist:
      #- src/legacy
    #
    # Blacklist files for which code generation should NOT be done
    #blacklist_files:
      #- lib/bootstrap.php
```

### Options

[](#options)

- `format` (optional) a list of formats in which code coverage should be generated. Can be one or many of: `clover`, `php`, `text`, `html`, `xml` (default `html`) **Note**: When using `clover` format option, you have to configure specific `output` file for the `clover` format (see below).
- `output` (optional) sets an output file/directory where specific code coverage format will be generated. If you configure multiple formats, takes a hash of `format:output` (e.g. `clover:coverage.xml`) (default `coverage`)
- `show_uncovered_files` (optional) for including uncovered files in coverage reports (default `true`)
- `lower_upper_bound` (optional) sets lower upper bound for code coverage (default `35`).
- `high_lower_bound` (optional) sets high lower bound for code coverage (default `70`)
- `whitelist` takes an array of directories to whitelist (default: `lib`, `src`).
- `whitelist_files` takes an array of files to whitelist (default: none).
- `blacklist` takes an array of directories to blacklist (default: `test, vendor, spec`)
- `blacklist_files` takes an array of files to blacklist

Authors
-------

[](#authors)

Copyright (c) 2017-2018 ek9  ().

Copyright (c) 2013-2016 Henrik Bjornskov, for portions of code from [henrikbjorn/phpspec-code-coverage](https://github.com/henrikbjorn/PhpSpecCodeCoverageExtension) project.

License
-------

[](#license)

Licensed under [MIT License](LICENSE).

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity66

Established project with proven stability

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

Recently: every ~84 days

Total

15

Last Release

2639d ago

Major Versions

v1.0.1 → v2.1.02017-02-12

v2.1.0 → v3.0.12017-02-14

v3.x-dev → v4.0.02017-10-17

PHP version history (5 changes)v1.0.1PHP &gt;=5.3.3

v2.1.0PHP ~5.3,^5.3.3||~7.0

v3.0.1PHP ~5.6||~7.0

v4.0.0PHP ^7.0

v4.2.0PHP ^7.1

### Community

Maintainers

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

---

Top Contributors

[![ek9](https://avatars.githubusercontent.com/u/17393048?v=4)](https://github.com/ek9 "ek9 (98 commits)")[![henrikbjorn](https://avatars.githubusercontent.com/u/19725?v=4)](https://github.com/henrikbjorn "henrikbjorn (45 commits)")[![Dragonrun1](https://avatars.githubusercontent.com/u/1431541?v=4)](https://github.com/Dragonrun1 "Dragonrun1 (7 commits)")[![kwisatz](https://avatars.githubusercontent.com/u/237949?v=4)](https://github.com/kwisatz "kwisatz (7 commits)")[![svemir](https://avatars.githubusercontent.com/u/154453?v=4)](https://github.com/svemir "svemir (4 commits)")[![sanmai](https://avatars.githubusercontent.com/u/139488?v=4)](https://github.com/sanmai "sanmai (4 commits)")[![Sam-Burns](https://avatars.githubusercontent.com/u/6594039?v=4)](https://github.com/Sam-Burns "Sam-Burns (4 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (3 commits)")[![lookitsatravis](https://avatars.githubusercontent.com/u/606978?v=4)](https://github.com/lookitsatravis "lookitsatravis (3 commits)")[![rnijveld](https://avatars.githubusercontent.com/u/193783?v=4)](https://github.com/rnijveld "rnijveld (2 commits)")[![michaldudek](https://avatars.githubusercontent.com/u/802141?v=4)](https://github.com/michaldudek "michaldudek (2 commits)")[![milan](https://avatars.githubusercontent.com/u/3963?v=4)](https://github.com/milan "milan (2 commits)")[![fesor](https://avatars.githubusercontent.com/u/172247?v=4)](https://github.com/fesor "fesor (2 commits)")[![DavidGarciaCat](https://avatars.githubusercontent.com/u/7809429?v=4)](https://github.com/DavidGarciaCat "DavidGarciaCat (2 commits)")[![exu](https://avatars.githubusercontent.com/u/30776?v=4)](https://github.com/exu "exu (2 commits)")[![wimvds](https://avatars.githubusercontent.com/u/777114?v=4)](https://github.com/wimvds "wimvds (1 commits)")[![Anyqax](https://avatars.githubusercontent.com/u/3055796?v=4)](https://github.com/Anyqax "Anyqax (1 commits)")[![digitalkaoz](https://avatars.githubusercontent.com/u/293591?v=4)](https://github.com/digitalkaoz "digitalkaoz (1 commits)")[![franmomu](https://avatars.githubusercontent.com/u/720690?v=4)](https://github.com/franmomu "franmomu (1 commits)")[![gabiudrescu](https://avatars.githubusercontent.com/u/5156054?v=4)](https://github.com/gabiudrescu "gabiudrescu (1 commits)")

---

Tags

testcoveragecodetestsreportgenerationspecphpspeccloverbuildgeneratereportscode coverage

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/dragonrun1-phpspec-code-coverage/health.svg)

```
[![Health](https://phpackages.com/badges/dragonrun1-phpspec-code-coverage/health.svg)](https://phpackages.com/packages/dragonrun1-phpspec-code-coverage)
```

###  Alternatives

[leanphp/behat-code-coverage

Generate Code Coverage reports for Behat tests

50359.8k2](/packages/leanphp-behat-code-coverage)[dvdoug/behat-code-coverage

Generate Code Coverage reports for Behat tests

593.6M37](/packages/dvdoug-behat-code-coverage)[friends-of-phpspec/phpspec-code-coverage

Generate Code Coverage reports for PhpSpec tests

202.6M125](/packages/friends-of-phpspec-phpspec-code-coverage)[benconstable/phpspec-laravel

Test your Laravel applications with PhpSpec

144347.1k15](/packages/benconstable-phpspec-laravel)

PHPackages © 2026

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