# sebastianbergmann/php-code-coverage

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/sebastianbergmann-php-code-coverage).**

8,931 stars · 384 forks · PHP · BSD-3-Clause

## Links

- GitHub: https://github.com/sebastianbergmann/php-code-coverage
- awesome-repositories: https://awesome-repositories.com/repository/sebastianbergmann-php-code-coverage.md

## Description

php-code-coverage is a PHP library and analysis tool designed to track runtime execution and determine which parts of a codebase are exercised by automated tests. It monitors executed lines and branches during a test run to identify gaps in test coverage and evaluate the effectiveness of a test suite.

The tool functions as an execution tracker and report generator that transforms raw PHP execution data into human-readable formats. It serializes collected metrics for storage and utilizes a processing system to calculate the total percentage of code covered.

Its capability surface covers the entire coverage lifecycle, including data collection, analytical processing, and visual report rendering. It employs source mapping to associate execution offsets with original file lines and uses a driver-based approach to extract statistics from PHP extensions.

## Tags

### Testing & Quality Assurance

- [Code Coverage Analysis](https://awesome-repositories.com/f/testing-quality-assurance/code-coverage-analysis.md) — Monitors executed lines and branches during test runs to identify untested areas of the codebase. ([source](https://github.com/sebastianbergmann/php-code-coverage#readme))
- [Code Coverage Libraries](https://awesome-repositories.com/f/testing-quality-assurance/code-coverage-libraries.md) — Provides a library for collecting and processing execution data to determine codebase coverage.
- [Execution Trackers](https://awesome-repositories.com/f/testing-quality-assurance/execution-trackers.md) — Monitors the runtime execution of PHP scripts to identify gaps in automated test suites.
- [Execution Data Serialization](https://awesome-repositories.com/f/testing-quality-assurance/code-coverage-analysis/execution-data-serialization.md) — Provides utilities for serializing and saving collected execution data to files for storage. ([source](https://github.com/sebastianbergmann/php-code-coverage/blob/main/README.md))
- [Report Generators](https://awesome-repositories.com/f/testing-quality-assurance/code-coverage-analysis/report-generators.md) — Transforms raw coverage data into structured, human-readable summaries and visual reports. ([source](https://github.com/sebastianbergmann/php-code-coverage/blob/main/README.md))
- [Application Testing Workflows](https://awesome-repositories.com/f/testing-quality-assurance/software-testing/testing-frameworks/unit/unit-testing/application-testing-workflows.md) — Integrates execution data collection into the PHP testing workflow to verify critical code paths.
- [Quality Assurance Practices](https://awesome-repositories.com/f/testing-quality-assurance/testing-best-practices-methodologies/quality-assurance-practices.md) — Helps implement quality assurance practices by visualizing unexecuted code paths to improve test suites.

### Programming Languages & Runtimes

- [PHP Code Analysis](https://awesome-repositories.com/f/programming-languages-runtimes/php-code-analysis.md) — Analyzes PHP runtime execution and calculates coverage metrics for source code analysis.

### System Administration & Monitoring

- [Execution Tracing](https://awesome-repositories.com/f/system-administration-monitoring/execution-tracing.md) — Captures line-by-line execution flow by interfacing with PHP engine extensions like Xdebug.

### Data & Databases

- [Snapshot Persistence](https://awesome-repositories.com/f/data-databases/key-value-persistence-stores/snapshot-persistence.md) — Saves serialized execution snapshots to the filesystem for asynchronous processing and future report generation.

### Development Tools & Productivity

- [Bytecode-to-Source Mapping](https://awesome-repositories.com/f/development-tools-productivity/source-map-generators/event-to-source-mapping/bytecode-to-source-mapping.md) — Maps runtime execution offsets back to the original source code lines for accurate coverage reporting.
- [Driver-Based Provider Architectures](https://awesome-repositories.com/f/development-tools-productivity/third-party-service-integrations/driver-based-provider-architectures.md) — Uses a driver-based architecture to interchangeably fetch execution statistics from various PHP coverage extensions.

### Software Engineering & Architecture

- [Report Renderers](https://awesome-repositories.com/f/software-engineering-architecture/pluggable-backends/report-renderers.md) — Provides pluggable report renderers that transform processed coverage metrics into human-readable visual formats.
