Download the PHP package league/phpunit-coverage-listener without Composer

On this page you can find all versions of the php package league/phpunit-coverage-listener. 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 phpunit-coverage-listener

PHPUnit Coverage Listener

Build Status Dependencies Status Coverage Status Latest Stable Version Total Downloads

PHPUnit Coverage Listener is a utility library that allow you to process the PHPUnit code-coverage information and send it into some remote location via cURL.

The main goal of the PHPunit Coverage Listener package is to provide a mechanism that generate a payload data (from PHPUnit code-coverage information) named coverage.json and send it to remote location, with bellow structure (simplified) :

Then in the target server, you could accept the payload as follow (simplified) :

Above json data could be process furthermore to expose usefull information about your code-coverage information in a way that fit with your specific needs. Coveralls service would be a perfect example in this scenario.

Requirement

Install

Via Composer

Basic Usage

Let's say you want to send a payload data for Coveralls each time your Travis job successfully build. All you need to do is adding bellow section within your phpunit configuration that used by .travis.yml (mostly you wont need this in your development environment) :

And thats it.

Advance Usage

As you may noticed on previous section, in order to work properly, Listener class need to know several things. They are being passed from your phpunit configuration within listener arguments directive.

Bellow table describe each configuration options respectively :

Key Name Value Description
printer League\PHPUnitCoverageListener\PrinterInterface Required
hook League\PHPUnitCoverageListener\HookInterface Optional
namespace String Optional
repo_token String Required
target_url String Required
coverage_dir String Required
send bool Optional

printer

This option contains PrinterInterface that will be used by Listener class in several points. In previous section, we set it to use StdOut printer that will print out any output informations directly into standard output. You could use your own printer class as long as it implements required interface.

hook

This option allow you to hook into Listener life-cycle. HookInterface has two method to be implemented : beforeCollect and afterCollect. It will receive Collection data, and then will alter or do something with the data on each hook point. In the previous example, Travis hook actually only contains bellow code :

Currently there are Travis and Circle hooks. You could register your own hook class that suit for your need as long as it implements required interface.

namespace

Option namespace string could be passed into the Listener, so that the generated coverage information use "relative" name instead literal file path. For example, if your source is src/My/Package/Resource.php, and you passing My\Package as namespace option, generated file name within coverage payload data will be My/Package/Resource.php.

repo_token

This option could be anything. Timestamp? Coveralls account token? Jenkins build token? Its up to you. But it was still neccessary to supply this option into the Listener class.

target_url

This option could be any valid url. For example, if you use Coveralls this option can be set to its REST endpoint : https://coveralls.io/api/v1/jobs.

coverage_dir

The directory you specified here must be the same directory from which PHPUnit generate coverage.xml report. Listener will also outputing coverage.json within this directory, so ensure this directory is writable.

send

As default, this library purpose is to collect and generate code-coverage data then send those payload data into remote location. But if you want to only collect and generate the data, add bellow option :

within the listener arguments array directive.

Changelog

See the changelog file

Contributing

Please see CONTRIBUTING for details.

Support

Bugs and feature request are tracked on GitHub

License

PHPUnit Coverage Listener is released under the MIT License. See the bundled LICENSE file for details.


All versions of phpunit-coverage-listener with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.3
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 league/phpunit-coverage-listener contains the following files

Loading the files please wait ....