Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Phpspec Code Coverage Laravel Package

henrikbjorn/phpspec-code-coverage

Deprecated PhpSpec extension that generates code coverage reports (HTML by default, plus clover/php/text) with configurable whitelists/blacklists and output paths. Install via Composer, enable in phpspec.yml, run phpspec (or phpdbg on PHP 7+).

View on GitHub
Deep Wiki
Context7

Getting Started

This package is deprecated and archived, but still functional for legacy PhpSpec setups (v2–v3). For Laravel developers, this package is not applicable—Laravel uses PHPUnit, not PhpSpec, and integrates code coverage natively via php artisan test --coverage-html. If you must work with an existing PhpSpec codebase:

  1. Install with composer require --dev henrikbjorn/phpspec-code-coverage
  2. Enable in phpspec.yml:
    extensions:
      - PhpSpecCodeCoverage\CodeCoverageExtension
    
  3. Run phpspec run — coverage lands in coverage/ (HTML by default).
    First use case: Verify coverage on a new spec with phpspec run -v to see summary in CLI and inspect coverage/index.html.

Implementation Patterns

  • Speed up coverage with phpdbg: Use phpdbg -qrr phpspec run (PHP 7+) to avoid Xdebug’s slowdown — this extension explicitly supports phpdbg.
  • Fine-tune coverage scope via whitelist/blacklist in phpspec.yml:
    extensions:
      PhpSpecCodeCoverage\CodeCoverageExtension:
        whitelist: [src]
        blacklist: [src/Entity/, src/Console/]
    
  • Generate multiple formats for CI and local use:
    format: [html, clover]
    output:
      html: coverage
      clover: coverage.xml
    
  • Enforce coverage thresholds to fail CI if coverage drops:
    lower_upper_bound: 45
    high_lower_bound: 80
    

Gotchas and Tips

  • ⚠️ Deprecated and unmaintained since 2016 — use the leanphp fork (though it’s also outdated) for any future proofing. Not recommended for new projects.
  • Xdebug required at runtime unless using phpdbg, despite being listed in require-dev.
  • No coverage shown by default — add -v verbosity to see CLI summary; otherwise, only file-based reports appear.
  • Paths are relative to project root, not phpspec.yml — e.g., output: coverage creates ./coverage/, not config/coverage/.
  • Clover silently fails if output.clover is missing — always pair format + output explicitly:
    format: clover
    output: coverage.xml  # ❌ fails silently
    # vs
    output:
      clover: coverage.xml  # ✅ works
    
  • Avoid show_uncovered_files: false — hiding uncovered files masks critical gaps; default true is safer for quality control.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport