PHPackages                             codacy/coverage - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. codacy/coverage

AbandonedArchivedLibrary[Testing &amp; Quality](/categories/testing)

codacy/coverage
===============

Sends PHP test coverage information to Codacy.

1.4.3(6y ago)471.5M—3.7%1820MITPHPPHP &gt;=5.3.3

Since Aug 25Pushed 6y ago12 watchersCompare

[ Source](https://github.com/codacy/php-codacy-coverage)[ Packagist](https://packagist.org/packages/codacy/coverage)[ Docs](https://github.com/codacy/php-codacy-coverage)[ RSS](/packages/codacy-coverage/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (17)Used By (20)

Deprecated
==========

[](#deprecated)

This repository is no longer maintained. As an alternative, check [codacy-coverage-reporter](https://github.com/codacy/codacy-coverage-reporter) to send your test coverage results to your Codacy dashboard.

[![Codacy Badge](https://camo.githubusercontent.com/d2d03837b96acce2e390ac0607a44bb32b3231bff7fea9d218591c49ae03141d/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f67726164652f6439393261383632623139393438303539303765633237376531366230666461)](https://www.codacy.com/app/Codacy/php-codacy-coverage)[![Codacy Badge](https://camo.githubusercontent.com/2420db6eb2da448fd54ab75e2438db7a27b884cc354aad3f4d07a7661e90fd52/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f636f7665726167652f6439393261383632623139393438303539303765633237376531366230666461)](https://www.codacy.com/app/Codacy/php-codacy-coverage)[![Circle CI](https://camo.githubusercontent.com/74553c27e6962c8f30be0171d76681de7bf8a389b723c51b02a5610dc8651b28/68747470733a2f2f636972636c6563692e636f6d2f67682f636f646163792f7068702d636f646163792d636f7665726167652e7376673f7374796c653d736869656c6426636972636c652d746f6b656e3d3a636972636c652d746f6b656e)](https://circleci.com/gh/codacy/php-codacy-coverage)[![Latest Stable Version](https://camo.githubusercontent.com/cd7c32ef9672a46987029dab6794e42e6fd3d52c20f3b48c8b6a69032511b8f8/68747470733a2f2f706f7365722e707567782e6f72672f636f646163792f636f7665726167652f76657273696f6e)](https://packagist.org/packages/codacy/coverage)

Codacy PHP Coverage Reporter
============================

[](#codacy-php-coverage-reporter)

[Codacy](https://codacy.com/) coverage support for PHP. Get coverage reporting and code analysis for PHP from Codacy.

Prerequisites
=============

[](#prerequisites)

- PHP 5.3 or later
- One of the following coverage report formats
    - Clover XML (e.g. `--coverage-clover` in PHPUnit)
    - \[Only for PHPUnit &lt;4\] PHPUnit XML (e.g. `--coverage-xml` in PHPUnit)

Installation
============

[](#installation)

Setup codacy-coverage with Composer, just add the following to your composer.json:

```
// composer.json
{
    "require-dev": {
        "codacy/coverage": "dev-master"
    }
}
```

Download the dependencies by running Composer in the directory of your `composer.json`:

```
# install
$ php composer.phar install --dev
# update
$ php composer.phar update codacy/coverage --dev
```

codacy-coverage library is available on [Packagist](https://packagist.org/packages/codacy/coverage).

Add the autoloader to your php script:

```
require_once 'vendor/autoload.php';
```

> Note: We have php5-curl dependency, if you have issues related to curl\_init() please install it with:

```
sudo apt-get install php5-curl

```

Alternative Installation (using phar)
-------------------------------------

[](#alternative-installation-using-phar)

Setup codacy-coverage as phar, you can simply download a pre-compiled and ready-to-use version as a phar to any directory. Simply download the latest `codacy-coverage.phar` file from our [releases page](https://github.com/codacy/php-codacy-coverage/releases):

[Latest release](https://github.com/codacy/php-codacy-coverage/releases/latest)

That's it already.

Updating Codacy
---------------

[](#updating-codacy)

To update Codacy, you will need your project API token. You can find the token in Project -&gt; Settings -&gt; Integrations -&gt; Project API.

Then set it in your terminal, replacing %Project\_Token% with your own token:

```
export CODACY_PROJECT_TOKEN=%Project_Token%

```

> Note: You should keep your API token well **protected**, as it grants owner permissions to your projects.

> To send coverage in the enterprise version you should:

```
export CODACY_API_BASE_URL=:16006

```

Usage
=====

[](#usage)

Run `vendor/bin/codacycoverage` to see a list of commands.

#### Basic usage for Clover format:

[](#basic-usage-for-clover-format)

`vendor/bin/codacycoverage clover`

#### Basic usage for PHPUnit XML format:

[](#basic-usage-for-phpunit-xml-format)

`php vendor/bin/codacycoverage phpunit`

By default we assume that

- your Clover coverage report is saved in `build/logs/clover.xml`
- your PHPUnit XML report is saved in the directory `build/coverage-xml`

#### Optional parameters:

[](#optional-parameters)

You can specify the path to your report with the second parameter:

- Clover XML
    - `php vendor/bin/codacycoverage clover path/to/a-clover.xml`
- PHPUnit XML
    - `php vendor/bin/codacycoverage phpunit directory/path/to/phpunitreport`

Even more control:

- `--base-url=` defaults to
- `--git-commit=` defaults to the last commit hash

Circle CI
---------

[](#circle-ci)

This project sends its own coverage during the build in circleCI. Feel free to check our `circle.yml`, and send your coverage as a step of your build process.

Travis CI
---------

[](#travis-ci)

Add codacycoverage to your `.travis.yml`:

```
# .travis.yml
language: php

# Do not forget to provide your CODACY_PROJECT_TOKEN as described in https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings

php:
  - 5.3
  - 5.4
  - 5.5
  - 5.6
  - hhvm

# In case of timeouts and build failures you may want to prepend 'travis_retry' to the following commands:
before_script:
  - curl -s http://getcomposer.org/installer | php
  - php composer.phar install -n

script:
  - php vendor/bin/phpunit --coverage-clover build/coverage/xml

after_script:
  - php vendor/bin/codacycoverage clover build/coverage/xml
```

Troubleshooting
---------------

[](#troubleshooting)

If you have a fatal error regarding curl\_init():

```
PHP Fatal error:  Uncaught Error: Call to undefined function Codacy\Coverage\Util\curl_init() in /src/Codacy/Coverage/Util/CodacyApiClient.php:30

```

Run: `sudo apt-get install php5-curl`

What is Codacy?
---------------

[](#what-is-codacy)

[Codacy](https://www.codacy.com/) is an Automated Code Review Tool that monitors your technical debt, helps you improve your code quality, teaches best practices to your developers, and helps you save time in Code Reviews.

### Among Codacy’s features:

[](#among-codacys-features)

- Identify new Static Analysis issues
- Commit and Pull Request Analysis with GitHub, BitBucket/Stash, GitLab (and also direct git repositories)
- Auto-comments on Commits and Pull Requests
- Integrations with Slack, HipChat, Jira, YouTrack
- Track issues in Code Style, Security, Error Proneness, Performance, Unused Code and other categories

Codacy also helps keep track of Code Coverage, Code Duplication, and Code Complexity.

Codacy supports PHP, Python, Ruby, Java, JavaScript, and Scala, among others.

### Free for Open Source

[](#free-for-open-source)

Codacy is free for Open Source projects.

License
-------

[](#license)

[MIT](LICENSE)

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity51

Moderate usage in the ecosystem

Community51

Growing community involvement

Maturity66

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~133 days

Recently: every ~213 days

Total

13

Last Release

2320d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4bea5005300e3798b0575fa77d4c523f162c04622b4396555cdadeff84c0af7d?d=identicon)[haffla](/maintainers/haffla)

![](https://www.gravatar.com/avatar/be4b6e46502d54032b7332900562627d244625dbd2570d9326863fcebcf2b328?d=identicon)[mrfyda](/maintainers/mrfyda)

![](https://www.gravatar.com/avatar/48a2f4f7946113cb68891cd81b439f5182a293ed40fe083a18ef188c36811375?d=identicon)[codacy](/maintainers/codacy)

![](https://www.gravatar.com/avatar/b300a2e90ea169bd36514313fac2606b6f198991c14d6d25fb4e5cc4d797944f?d=identicon)[lolgab](/maintainers/lolgab)

![](https://www.gravatar.com/avatar/cb304a60a2d4214fb5adc5cb096204b0cf5fbd192c4ac6d653a13f2874151a1b?d=identicon)[franciscodua](/maintainers/franciscodua)

---

Top Contributors

[![haffla](https://avatars.githubusercontent.com/u/2844304?v=4)](https://github.com/haffla "haffla (31 commits)")[![machadoit](https://avatars.githubusercontent.com/u/13315199?v=4)](https://github.com/machadoit "machadoit (19 commits)")[![mrfyda](https://avatars.githubusercontent.com/u/593860?v=4)](https://github.com/mrfyda "mrfyda (16 commits)")[![rtfpessoa](https://avatars.githubusercontent.com/u/902384?v=4)](https://github.com/rtfpessoa "rtfpessoa (11 commits)")[![ottlinger](https://avatars.githubusercontent.com/u/1323134?v=4)](https://github.com/ottlinger "ottlinger (8 commits)")[![kirillkomlev](https://avatars.githubusercontent.com/u/11974167?v=4)](https://github.com/kirillkomlev "kirillkomlev (7 commits)")[![lolgab](https://avatars.githubusercontent.com/u/5793054?v=4)](https://github.com/lolgab "lolgab (6 commits)")[![MaSpeng](https://avatars.githubusercontent.com/u/18685557?v=4)](https://github.com/MaSpeng "MaSpeng (4 commits)")[![josemiguelmelo](https://avatars.githubusercontent.com/u/7714220?v=4)](https://github.com/josemiguelmelo "josemiguelmelo (3 commits)")[![julien-boudry](https://avatars.githubusercontent.com/u/4020317?v=4)](https://github.com/julien-boudry "julien-boudry (2 commits)")[![azettl](https://avatars.githubusercontent.com/u/644570?v=4)](https://github.com/azettl "azettl (2 commits)")[![nmatpt](https://avatars.githubusercontent.com/u/5034733?v=4)](https://github.com/nmatpt "nmatpt (2 commits)")[![pedrorijo91](https://avatars.githubusercontent.com/u/1999050?v=4)](https://github.com/pedrorijo91 "pedrorijo91 (2 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (1 commits)")[![caxaria](https://avatars.githubusercontent.com/u/375246?v=4)](https://github.com/caxaria "caxaria (1 commits)")[![captn3m0](https://avatars.githubusercontent.com/u/584253?v=4)](https://github.com/captn3m0 "captn3m0 (1 commits)")[![Grummfy](https://avatars.githubusercontent.com/u/668804?v=4)](https://github.com/Grummfy "Grummfy (1 commits)")[![Ghriim](https://avatars.githubusercontent.com/u/1705745?v=4)](https://github.com/Ghriim "Ghriim (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/codacy-coverage/health.svg)

```
[![Health](https://phpackages.com/badges/codacy-coverage/health.svg)](https://phpackages.com/packages/codacy-coverage)
```

###  Alternatives

[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[phan/phan

A static analyzer for PHP

5.6k11.2M1.1k](/packages/phan-phan)[behat/behat

Scenario-oriented BDD framework for PHP

4.0k96.8M2.0k](/packages/behat-behat)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[phpro/grumphp

A composer plugin that enables source code quality checks.

4.3k15.5M904](/packages/phpro-grumphp)[phpbench/phpbench

PHP Benchmarking Framework

2.0k13.0M627](/packages/phpbench-phpbench)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
