Weave 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
Php Code Coverage

Php Code Coverage Laravel Package

phpunit/php-code-coverage

phpunit/php-code-coverage collects, processes, and renders PHP code coverage data. It provides drivers, filters, and report generation for PHPUnit test suites, including serialized coverage data and OpenClover output, helping teams track which lines of code tests execute.

View on GitHub
Deep Wiki
Context7

Library that provides collection, processing, and rendering functionality for PHP code coverage information.

Frequently asked questions about Php Code Coverage
What is phpunit/php-code-coverage used for?
It collects, processes, and renders PHP code coverage data for test suites. In Laravel projects it powers coverage reporting through PHPUnit or Pest, showing which lines of application and test code are executed. It provides drivers, filters, serialization, and report generation.
How do I install phpunit/php-code-coverage in a Laravel project?
Install it with Composer as a development dependency using composer require --dev phpunit/php-code-coverage. Laravel’s default PHPUnit setup can then use it through PHPUnit coverage options or custom scripts. Keep it in require-dev because coverage is only needed during testing and CI.
Which PHP and Laravel versions are supported by phpunit/php-code-coverage v14?
Version 14 drops older PHP versions, so your Laravel 10+ environment must run a PHP version allowed by the package’s Composer constraints. Enforce that PHP version in composer.json and CI before upgrading. If your application cannot meet v14 requirements, ^12.5 can be used for legacy support.
Does phpunit/php-code-coverage work with Pest as well as PHPUnit?
Yes. Laravel’s primary testing stack includes PHPUnit and Pest, and this package integrates with that stack for coverage collection and reporting. Pest runs on PHPUnit under the hood, so coverage generated through PHPUnit can be used in Pest-based Laravel projects.
How do I configure Xdebug or PCOV coverage drivers for Laravel?
Configure the coverage driver in phpunit.xml or composer.json coverage settings, such as xdebug, and define included paths like app/* and tests/*. Driver conflicts can still cause coverage or XML issues, so test both Xdebug and PCOV in CI and文档 the required setup. The package’s driver selector handles driver selection for line coverage.
What coverage report formats does phpunit/php-code-coverage support?
It supports report generation including HTML, XML, Clover, Cobertura, and OpenClover output, plus serialized coverage data. XML and Clover reports are lightweight options for CI artifacts, while HTML is useful for local review. You can render reports directly or from serialized data using the report facade.
Is phpunit/php-code-coverage a runtime dependency for Laravel applications?
No. It is typically a development-time dependency used only when running tests and generating coverage. The package is framework-agnostic and dependency-light, so it does not couple your Laravel application runtime to coverage tooling.
How does phpunit/php-code-coverage handle parallel test coverage merging?
Version 14.4.1 fixes a performance problem in CodeCoverage::merge() that becomes relevant when merging coverage artifacts from many processes. For parallelized CI, target ^14.4.1 to avoid the previous quadratic merge overhead. Benchmark parallel jobs after upgrading and merge artifacts once per pipeline where possible.
Is upgrading to phpunit/php-code-coverage 14.4.1 safe for existing Laravel projects?
14.4.1 is a patch release with no new public API surface and no configuration migration expected solely for this release. It is a low-risk upgrade from 14.1.x and related v14 releases, mainly fixing merge performance. Plan package upgrades when Laravel or PHP support changes, and assign someone to triage coverage anomalies.
Do I need phpunit/php-code-coverage, or are there alternatives for Laravel coverage?
Most Laravel and PHPUnit coverage workflows rely on this package as the foundational collector and renderer. Alternative tools and services such as Codecov or SonarQube usually consume its Clover or XML reports rather than replacing the underlying coverage collection. You can also build custom gating scripts around its report output.
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.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo