dvdoug/behat-code-coverage
Behat Code Coverage is a Behat extension that generates PHP code coverage reports while running your test suite. It wraps php-code-coverage—the same library used by PHPUnit—so reports are familiar and interoperable with existing tooling.
This is not a Laravel package in the framework-integration sense — it is a Behat extension that wraps phpunit/php-code-coverage so that BDD/acceptance scenarios executed by Behat produce standard coverage artifacts. Its PM value is therefore concentrated in one decision space: does our behavior/acceptance layer count toward quality metrics, or is it a black box?
xdebug_start_code_coverage() / PCOV shims inside Behat hooks and writing your own report serializers. This package gives you that plus maintained compatibility with every php-code-coverage major (v9 through v14), report schema validation in behat.yml, and the --no-coverage bypass — for free under BSD-2.branchAndPathCoverage, so you can price the difference between "line coverage on every PR" and "full branch coverage nightly."Adopt when:
reports key) or branch/path coverage under Xdebug.php-code-coverage majors, which is the main ongoing cost you are outsourcing.Look elsewhere when:
--coverage; adding Behat purely to obtain coverage is backwards. This is the majority case for Laravel teams and the single strongest reason to say no.phpcov/upstream merge tooling). Budget for that separately rather than assuming this solves it.php-code-coverage majors — support was explicitly removed, so you would be pinned to an old branch with no security path.For executives (one paragraph): We run behavior-level tests that describe product requirements, but today those tests produce no coverage evidence — we cannot say what percentage of the application they actually exercise. This extension closes that gap for a near-zero cost: it is a test-only, BSD-licensed dev dependency that emits the same coverage reports our CI and code-quality dashboard already consume. It introduces no production code, no runtime risk, and no new toolchain. It lets us put a measurable gate on our acceptance suite and produce audit-ready coverage artifacts, and if the project ever stalls we remove one dependency from a require-dev block.
For engineering (the practical case):
php-code-coverage output — the HTML, Clover, and Cobertura files your pipelines and Sonar already parse.behat.yml under a reports key with schema validation, so misconfiguration fails fast rather than producing silently empty reports.stderr, --no-coverage cleanly bypasses instrumentation, PCOV and Xdebug coexisting is handled, and there is a static-analysis cache for repeat runs.How can I help you explore Laravel packages today?