phpunit / php-code-coverage
Library that provides collection, processing, and rendering functionality for PHP code coverage information.
Fund package maintenance!
sebastianbergmann
Installs: 685 769 073
Dependents: 1 487
Suggesters: 9
Security: 0
Stars: 8 823
Watchers: 56
Forks: 374
Open Issues: 27
Requires
- php: >=8.2
- ext-dom: *
- ext-libxml: *
- ext-xmlwriter: *
- nikic/php-parser: ^5.3.1
- phpunit/php-file-iterator: ^5.1.0
- phpunit/php-text-template: ^4.0.1
- sebastian/code-unit-reverse-lookup: ^4.0.1
- sebastian/complexity: ^4.0.1
- sebastian/environment: ^7.2.0
- sebastian/lines-of-code: ^3.0.1
- sebastian/version: ^5.0.2
- theseer/tokenizer: ^1.2.3
Requires (Dev)
- phpunit/phpunit: ^11.4.1
Suggests
- ext-pcov: PHP extension that provides line coverage
- ext-xdebug: PHP extension that provides line coverage as well as branch and path coverage
- dev-main / 11.0.x-dev
- 11.0.7
- 11.0.6
- 11.0.5
- 11.0.4
- 11.0.3
- 11.0.2
- 11.0.1
- 11.0.0
- 10.1.x-dev
- 10.1.16
- 10.1.15
- 10.1.14
- 10.1.13
- 10.1.12
- 10.1.11
- 10.1.10
- 10.1.9
- 10.1.8
- 10.1.7
- 10.1.6
- 10.1.5
- 10.1.4
- 10.1.3
- 10.1.2
- 10.1.1
- 10.1.0
- 10.0.2
- 10.0.1
- 10.0.0
- 9.2.x-dev
- 9.2.32
- 9.2.31
- 9.2.30
- 9.2.29
- 9.2.28
- 9.2.27
- 9.2.26
- 9.2.25
- 9.2.24
- 9.2.23
- 9.2.22
- 9.2.21
- 9.2.20
- 9.2.19
- 9.2.18
- 9.2.17
- 9.2.16
- 9.2.15
- 9.2.14
- 9.2.13
- 9.2.11
- 9.2.10
- 9.2.9
- 9.2.8
- 9.2.7
- 9.2.6
- 9.2.5
- 9.2.4
- 9.2.3
- 9.2.2
- 9.2.1
- 9.2.0
- 9.1.11
- 9.1.10
- 9.1.9
- 9.1.8
- 9.1.7
- 9.1.6
- 9.1.5
- 9.1.4
- 9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-unit-information-is-passed-from-phpunit
This package is auto-updated.
Last update: 2024-11-19 09:03:12 UTC
README
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:
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 declare(strict_types=1); use SebastianBergmann\CodeCoverage\Filter; use SebastianBergmann\CodeCoverage\Driver\Selector; use SebastianBergmann\CodeCoverage\CodeCoverage; use SebastianBergmann\CodeCoverage\Report\Html\Facade as HtmlReport; $filter = new Filter; $filter->includeFiles( [ '/path/to/file.php', '/path/to/another_file.php', ] ); $coverage = new CodeCoverage( (new Selector)->forLineCoverage($filter), $filter ); $coverage->start('<name of test>'); // ... $coverage->stop(); (new HtmlReport)->process($coverage, '/tmp/code-coverage-report');