https://github.com/sebastianbergmann/php-code-coverage
Library that provides collection, processing, and rendering functionality for PHP code coverage information.
https://github.com/sebastianbergmann/php-code-coverage
Last synced: about 1 month ago
JSON representation
Library that provides collection, processing, and rendering functionality for PHP code coverage information.
- Host: GitHub
- URL: https://github.com/sebastianbergmann/php-code-coverage
- Owner: sebastianbergmann
- License: bsd-3-clause
- Created: 2009-05-28T16:01:43.000Z (almost 17 years ago)
- Default Branch: main
- Last Pushed: 2026-01-01T08:55:57.000Z (2 months ago)
- Last Synced: 2026-02-02T08:48:29.859Z (about 1 month ago)
- Language: PHP
- Homepage:
- Size: 61.6 MB
- Stars: 8,933
- Watchers: 52
- Forks: 384
- Open Issues: 32
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog-12.5.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
- favorite-link - 为 PHP 代码覆盖率信息提供收集,处理和呈现功能的库。
- php-awesome - CodeCoverage - 代码覆盖率报表工具 (类库 / 代码检查/静态分析)
README
# phpunit/php-code-coverage
[](https://packagist.org/packages/phpunit/php-code-coverage)
[](https://github.com/sebastianbergmann/php-code-coverage/actions)
[](https://codecov.io/gh/sebastianbergmann/php-code-coverage)
Provides collection, processing, and rendering functionality for PHP code coverage information.
## Installation
You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/):
```
composer require phpunit/php-code-coverage
```
If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency:
```
composer require --dev phpunit/php-code-coverage
```
## Usage
```php
includeFiles(
[
'/path/to/file.php',
'/path/to/another_file.php',
]
);
$coverage = new CodeCoverage(
(new Selector)->forLineCoverage($filter),
$filter
);
$coverage->start('');
// ...
$coverage->stop();
(new HtmlReport)->process($coverage, '/tmp/code-coverage-report');
```