PHPackages                             chr0n1x/php-coveralls - 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. chr0n1x/php-coveralls

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

chr0n1x/php-coveralls
=====================

PHP client library for Coveralls API

0.7.2(10y ago)010.0k1MITPHPPHP &gt;=5.3

Since Apr 15Pushed 10y agoCompare

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

READMEChangelog (3)Dependencies (15)Versions (14)Used By (1)

php-coveralls
=============

[](#php-coveralls)

[![Build Status](https://camo.githubusercontent.com/945d544f5c66b896bd5dc1198302e5673a4b312c896dde63aa98ffe71d38fabc/68747470733a2f2f7472617669732d63692e6f72672f7361746f6f7368692f7068702d636f766572616c6c732e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/satooshi/php-coveralls)[![Coverage Status](https://camo.githubusercontent.com/1aa4d7e229aa9eb9e2fdbc1d59bebdfde371d315aeef7bc2636a2faba16a63d4/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f7361746f6f7368692f7068702d636f766572616c6c732f62616467652e706e673f6272616e63683d6d6173746572)](https://coveralls.io/r/satooshi/php-coveralls)[![Dependency Status](https://camo.githubusercontent.com/1440f0f041a0f57c7c47a186dba9245db3b981b4cf3e1f7345ff4d468b99a72c/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f7061636b6167652f7068702d2d7361746f6f7368692d2d7068702d636f766572616c6c732f62616467652e706e67)](https://www.versioneye.com/package/php--satooshi--php-coveralls)

[![Latest Stable Version](https://camo.githubusercontent.com/a5250dc44e03667064bdcdd3f6b096abaf29340d040bbd2350280c6cefb7c0c6/68747470733a2f2f706f7365722e707567782e6f72672f7361746f6f7368692f7068702d636f766572616c6c732f762f737461626c652e706e67)](https://packagist.org/packages/satooshi/php-coveralls)[![Total Downloads](https://camo.githubusercontent.com/4d32126fe96dce91f1f8c75c294d0c4d5ab07252c77dfd77e4aa47a5b1b911c1/68747470733a2f2f706f7365722e707567782e6f72672f7361746f6f7368692f7068702d636f766572616c6c732f646f776e6c6f6164732e706e67)](https://packagist.org/packages/satooshi/php-coveralls)

PHP client library for [Coveralls](https://coveralls.io).

API doc
=======

[](#api-doc)

[API doc](http://satooshi.github.io/php-coveralls/api/) is generated by [ApiGen](http://apigen.org/)

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

[](#prerequisites)

- PHP 5.3 or later
- On [GitHub](https://github.com/)
- Building on [Travis CI](http://travis-ci.org/), [CircleCI](https://circleci.com/), [Jenkins](http://jenkins-ci.org/) or [Codeship](https://www.codeship.io/)
- Testing by [PHPUnit](https://github.com/sebastianbergmann/phpunit/) or other testing framework that can generate clover style coverage report

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

[](#installation)

To install php-coveralls with Composer, just add the following to your composer.json file:

```
// composer.json
{
    "require-dev": {
        "satooshi/php-coveralls": "dev-master"
    }
}
```

Then, you can install the new dependencies by running Composer’s update command from the directory where your `composer.json` file is located:

```
# install
$ php composer.phar install --dev
# update
$ php composer.phar update satooshi/php-coveralls --dev

# or you can simply execute composer command if you set it to
# your PATH environment variable
$ composer install --dev
$ composer update satooshi/php-coveralls --dev
```

You can see this library on [Packagist](https://packagist.org/packages/satooshi/php-coveralls).

Composer installs autoloader at `./vendor/autoloader.php`. If you use php-coveralls in your php script, add:

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

If you use Symfony2, autoloader has to be detected automatically.

Or you can use git clone command:

```
# HTTP
$ git clone https://github.com/satooshi/php-coveralls.git
# SSH
$ git clone git@github.com:satooshi/php-coveralls.git
```

Configuration
=============

[](#configuration)

Currently support clover style coverage report. php-coveralls collect coverage information from `clover.xml`.

PHPUnit
-------

[](#phpunit)

Make sure that `phpunit.xml.dist` is configured to generate "coverage-clover" type log named `clover.xml` like the following configuration:

```

        ...

        ...

```

You can also use `--coverage-clover` CLI option.

```
phpunit --coverage-clover build/logs/clover.xml
```

### phpcov

[](#phpcov)

Above settings are good for almost projects If your test suite is executed once a build and is not devided into several parts. But if your test suite is configured as parallel task or generates multiple coverage reports through a build, you can use either `coverage_clover` configuration in `.coveralls.yml` ([see below coverage clover configuration section](#coverage-clover-configuration)) to specify multiple `clover.xml` or `phpcov` for processing coverages reports.

#### composer.json

[](#composerjson)

`phpcov` is not ready for Packagist yet but you can install it via PEAR channel:

```
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "sebastianbergmann/phpcov",
                "version": "1.1.0",
                "dist": {
                    "url": "https://github.com/sebastianbergmann/phpcov/archive/1.1.0.zip",
                    "type": "zip"
                },
                "source": {
                    "url": "https://github.com/sebastianbergmann/phpcov.git",
                    "type": "git",
                    "reference": "1.1.0"
                },
                "bin": [
                    "phpcov.php"
                ]
            }
        }
    ],
    …
    "require-dev": {
        "satooshi/php-coveralls": "dev-master",
        "sebastianbergmann/phpcov": "1.1.0"
    },
```

#### phpunit configuration

[](#phpunit-configuration)

Make sure that `phpunit.xml.dist` is configured to generate "coverage-php" type log:

```

        ...

        ...

```

You can also use `--coverage-php` CLI option.

```
# use --coverage-php option instead of --coverage-clover
phpunit --coverage-php build/cov/coverage-${component_name}.cov
```

#### phpcov configuration

[](#phpcov-configuration)

And then, execute `phpcov.php` to merge `coverage.cov` logs.

```
# get information
php vendor/bin/phpcov.php --help

# merge coverage.cov logs under build/cov
php vendor/bin/phpcov.php --merge --clover build/logs/clover.xml --whitelist /path/to/src build/cov

# in case of memory exhausting error
php -d memory_limit=-1 vendor/bin/phpcov.php ...
```

### clover.xml

[](#cloverxml)

php-coveralls collects `count` attribute in a `line` tag from `clover.xml` if its `type` attribute equals to `stmt`. When `type` attribute equals to `method`, php-coveralls excludes its `count` attribute from coverage collection because abstract method in an abstract class is never counted though subclasses implement that method which is executed in test cases.

```

```

Travis CI
---------

[](#travis-ci)

Add `php vendor/bin/coveralls` to your `.travis.yml` at `after_script`.

```
# .travis.yml
language: php
php:
  - 5.5
  - 5.4
  - 5.3

matrix:
  allow_failures:
    - php: 5.5

before_script:
  - curl -s http://getcomposer.org/installer | php
  - php composer.phar install --dev --no-interaction

script:
  - mkdir -p build/logs
  - php vendor/bin/phpunit -c phpunit.xml.dist

after_script:
  - php vendor/bin/coveralls
  # or enable logging
  - php vendor/bin/coveralls -v
```

CircleCI
--------

[](#circleci)

Add `pecl install xdebug` to your `circle.yml` at `dependencies` section since currently Xdebug extension is not pre-installed. `composer` and `phpunit` are pre-installed but you can install them manually in this dependencies section. The following sample uses default ones.

```
machine:
  php:
    version: 5.4.10

## Customize dependencies
dependencies:
  override:
    - mkdir -p build/logs
    - composer install --dev --no-interaction
    - pecl install xdebug
    - cat ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini | sed -e "s/;//" > xdebug.ini
    - mv xdebug.ini ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini

## Customize test commands
test:
  override:
    - phpunit -c phpunit.xml.dist
```

Add `php vendor/bin/coveralls` to the "Test commands" textarea on Web UI (Edit settings &gt; Tests &gt; Test commands textarea).

```
COVERALLS_REPO_TOKEN=your_token php vendor/bin/coveralls
```

*Please note that `COVERALLS_REPO_TOKEN` should be set in the same line before coveralls command execution. You can not export this variable before coveralls command execution in other command since each command runs in its own shell and does not share environment variables ([see reference on CircleCI](https://circleci.com/docs/environment-variables)).*

Codeship
--------

[](#codeship)

You can configure CI process for Coveralls by adding the following commands to the textarea on Web UI (Project settings &gt; Test tab).

In the "Modify your Setup Commands" section:

```
curl -s http://getcomposer.org/installer | php
php composer.phar install --dev --no-interaction
mkdir -p build/logs
```

In the "Modify your Test Commands" section:

```
php vendor/bin/phpunit -c phpunit.xml.dist
php vendor/bin/coveralls
```

Next, open Project settings &gt; Environment tab, you can set `COVERALLS_REPO_TOKEN` environment variable.

In the "Configure your environment variables" section:

```
COVERALLS_REPO_TOKEN=your_token
```

From local environment
----------------------

[](#from-local-environment)

If you would like to call Coveralls API from your local environment, you can set `COVERALLS_RUN_LOCALLY` envrionment variable. This configuration requires `repo_token` to specify which project on Coveralls your project maps to. This can be done by configuring `.coveralls.yml` or `COVERALLS_REPO_TOKEN` environment variable.

```
$ export COVERALLS_RUN_LOCALLY=1

# either env var
$ export COVERALLS_REPO_TOKEN=your_token

# or .coveralls.yml configuration
$ vi .coveralls.yml
repo_token: your_token # should be kept secret!
```

php-coveralls set the following properties to `json_file` which is sent to Coveralls API (same behaviour as the Ruby library will do except for the service name).

- service\_name: php-coveralls
- service\_event\_type: manual

CLI options
-----------

[](#cli-options)

You can get help information for `coveralls` with the `--help (-h)` option.

```
php vendor/bin/coveralls --help
```

- `--config (-c)`: Used to specify the path to `.coveralls.yml`. Default is `.coveralls.yml`
- `--verbose (-v)`: Used to show logs.
- `--dry-run`: Used not to send json\_file to Coveralls Jobs API.
- `--exclude-no-stmt`: Used to exclude source files that have no executable statements.

.coveralls.yml
--------------

[](#coverallsyml)

php-coveralls can use optional `.coveralls.yml` file to configure options. This configuration file is usually at the root level of your repository, but you can specify other path by `--config (or -c)` CLI option. Following options are the same as Ruby library ([see reference on coveralls.io](https://coveralls.io/docs/ruby)).

- `repo_token`: Used to specify which project on Coveralls your project maps to. This is only needed for repos not using CI and should be kept secret
- `service_name`: Allows you to specify where Coveralls should look to find additional information about your builds. This can be any string, but using `travis-ci` or `travis-pro` will allow Coveralls to fetch branch data, comment on pull requests, and more.

Following options can be used for php-coveralls.

- `src_dir`: Used to specify where the root level of your source files directory is. Default is `src`.
- `coverage_clover`: Used to specify the path to `clover.xml`. Default is `build/logs/clover.xml`
- `json_path`: Used to specify where to output `json_file` that will be uploaded to Coveralls API. Default is `build/logs/coveralls-upload.json`.

```
# .coveralls.yml example configuration

# same as Ruby lib
repo_token: your_token # should be kept secret!
service_name: travis-pro # travis-ci or travis-pro

# for php-coveralls
src_dir: src
coverage_clover: build/logs/clover.xml
json_path: build/logs/coveralls-upload.json
```

### coverage clover configuration

[](#coverage-clover-configuration)

You can specify multiple `clover.xml` logs at `coverage_clover`. This is useful for a project that has more than two test suites if all of the test results should be merged into one `json_file`.

```
#.coveralls.yml

# single file
coverage_clover: build/logs/clover.xml

# glob
coverage_clover: build/logs/clover-*.xml

# array
# specify files
coverage_clover:
  - build/logs/clover-Auth.xml
  - build/logs/clover-Db.xml
  - build/logs/clover-Validator.xml
```

Change log
==========

[](#change-log)

[See changelog](CHANGELOG.md)

Wiki
====

[](#wiki)

[See wiki](https://github.com/satooshi/php-coveralls/wiki)

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 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 ~71 days

Recently: every ~192 days

Total

12

Last Release

3993d ago

PHP version history (2 changes)0.1.0PHP &gt;=5.3.17

0.5.0PHP &gt;=5.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1102319?v=4)[Kevin R.](/maintainers/chr0n1x)[@chr0n1x](https://github.com/chr0n1x)

---

Top Contributors

[![GeLoLabs](https://avatars.githubusercontent.com/u/149005863?v=4)](https://github.com/GeLoLabs "GeLoLabs (3 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (2 commits)")[![renan](https://avatars.githubusercontent.com/u/28046?v=4)](https://github.com/renan "renan (2 commits)")[![chr0n1x](https://avatars.githubusercontent.com/u/1102319?v=4)](https://github.com/chr0n1x "chr0n1x (2 commits)")[![bartfeenstra](https://avatars.githubusercontent.com/u/376735?v=4)](https://github.com/bartfeenstra "bartfeenstra (1 commits)")[![zomble](https://avatars.githubusercontent.com/u/542255?v=4)](https://github.com/zomble "zomble (1 commits)")[![hkdobrev](https://avatars.githubusercontent.com/u/506129?v=4)](https://github.com/hkdobrev "hkdobrev (1 commits)")[![jubianchi](https://avatars.githubusercontent.com/u/327237?v=4)](https://github.com/jubianchi "jubianchi (1 commits)")[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (1 commits)")

---

Tags

testcoveragegithubci

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/chr0n1x-php-coveralls/health.svg)

```
[![Health](https://phpackages.com/badges/chr0n1x-php-coveralls/health.svg)](https://phpackages.com/packages/chr0n1x-php-coveralls)
```

###  Alternatives

[php-coveralls/php-coveralls

PHP client library for Coveralls API

51413.7M3.4k](/packages/php-coveralls-php-coveralls)[behat/behat

Scenario-oriented BDD framework for PHP

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

Infection is a Mutation Testing framework for PHP. The mutation adequacy score can be used to measure the effectiveness of a test set in terms of its ability to detect faults.

2.2k26.2M1.8k](/packages/infection-infection)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)

PHPackages © 2026

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