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: 10 days 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 16 years ago)
- Default Branch: main
- Last Pushed: 2025-04-13T07:27:53.000Z (20 days ago)
- Last Synced: 2025-04-16T00:07:53.222Z (18 days ago)
- Language: PHP
- Homepage:
- Size: 69.6 MB
- Stars: 8,879
- Watchers: 55
- Forks: 377
- Open Issues: 32
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog-12.1.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- 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');
```