Download the PHP package phpunit/phpcov without Composer

On this page you can find all versions of the php package phpunit/phpcov. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package phpcov

Latest Stable Version CI Status codecov

phpcov

phpcov is a command-line frontend for the php-code-coverage library.

Installation

This tool is distributed as a PHP Archive (PHAR):

Please replace X.Y with the version of PHPCOV you are interested in.

Using Phive is the recommended way for managing the tool dependencies of your project:

It is not recommended to use Composer to download and install this tool.

Usage

Merging serialized code coverage data

When you run PHPUnit with --coverage-php, it writes serialized code coverage data to a .cov file. The phpcov merge command merges multiple .cov files into a single code coverage report.

This is useful when you run test suites in parallel or across separate processes and want to combine the results into one report.

Example

Run your test suites separately, each writing their own .cov file:

Then merge the .cov files and generate a report:

All .cov files in the specified directory will be merged.

You can generate reports in multiple formats at once:

Exporting merged data

Use --php to write the merged coverage data back to a .cov file:

Merging on a different machine

The serialized .cov files store file paths relative to a base path (the common path prefix of all covered files). When generating reports, the source files must be readable so that they can be analysed.

If you are merging .cov files on a different machine than where the tests were run, and the source code is located at a different path, use --source to specify where the source code is on the current machine:

Relaxing merge requirements

By default, phpcov merge requires that all .cov files were created using the same PHP version, the same code coverage driver, and (when present) the same Git state. If these do not match, the merge will fail.

You can relax these requirements with the following options:

Option Effect
--do-not-require-matching-git-information Allow merging files with different git state
--do-not-require-matching-php-version Allow merging files from different PHP versions
--do-not-require-matching-code-coverage-driver Allow merging files from different coverage drivers

For example, to merge .cov files that were collected with different PHP versions:

Available Report Formats

Option Format
--clover <file> Clover XML
--openclover <file> OpenClover XML
--cobertura <file> Cobertura XML
--crap4j <file> Crap4J XML
--html <directory> HTML
--php <file> Serialized PHP (.cov)
--text <file> Plain text
--xml <directory> PHPUnit XML

Patch Coverage

The phpcov patch-coverage command calculates code coverage for the lines changed in a patch (unified diff). It reports how many of the changed executable lines are covered by tests.

Example

Generate a unified diff and collect code coverage:

Then calculate patch coverage:

The command exits with code 0 when all changed executable lines are covered. It exits with 1 when some changed executable lines are not covered. It exits with 2 when no changed executable lines could be detected. This usually indicates a path mismatch.

The --path-prefix option

The --path-prefix option is needed when the file paths in the patch do not match the file paths in the coverage data.

The serialized .cov file stores file paths relative to a base path. The patch file contains paths relative to wherever git diff (or equivalent) was run. When both are relative to the same project root directory, which is the common case, they match and --path-prefix is not needed.

When the paths do not match, --path-prefix specifies the directory to prepend to the paths in the patch so that they can be resolved against the coverage data. For example, if the diff was generated from a parent directory and contains paths like project/src/Foo.php, but the coverage data has paths relative to the project root (src/Foo.php), you would use:


All versions of phpcov with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
phpunit/php-code-coverage Version ^14.1.3
phpunit/php-file-iterator Version ^7.0.0
sebastian/cli-parser Version ^5.0.0
sebastian/diff Version ^8.1.0
sebastian/version Version ^7.0.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package phpunit/phpcov contains the following files

Loading the files please wait ...