The PHP Unit Testing framework.
PHP Shell
Pull request Compare This branch is 3 commits ahead, 2428 commits behind sebastianbergmann:master.


PHPUnit is the de-facto standard for unit testing in PHP projects. It provides both a framework that makes the writing of tests easy as well as the functionality to easily run the tests and analyse their results.


  • PHPUnit 3.8 requires PHP 5.4.7 (or later).
  • PHP_CodeCoverage, the library that is used by PHPUnit to collect and process code coverage information, depends on Xdebug 2.2.1 (or later).


PHP Archive (PHAR)

The easiest way to obtain PHPUnit is to download a PHP Archive (PHAR) that has all required (as well as some optional) dependencies of PHPUnit bundled in a single file:

chmod +x phpunit.phar
mv phpunit.phar /usr/local/bin/phpunit

You can also immediately use the PHAR after you have downloaded it, of course:

php phpunit.phar


Simply add a dependency on phpunit/phpunit to your project's composer.json file if you use Composer to manage the dependencies of your project. Here is a minimal example of a composer.json file that just defines a development-time dependency on PHPUnit 3.7:

    "require-dev": {
        "phpunit/phpunit": "3.7.*"

For a system-wide installation via Composer, you can run:

composer global require 'phpunit/phpunit=3.7.*'

Make sure you have ~/.composer/vendor/bin/ in your path.

PEAR Installer

The following two commands (which you may have to run as root) are all that is required to install PHPUnit using the PEAR Installer:

pear config-set auto_discover 1
pear install


The documentation for PHPUnit is available in different formats:

API Documentation

The API documentation is generated using phpDox.

Mailing Lists

  • is a list for those who want to help out with the development of PHPUnit
  • is a list for general PHPUnit support; ask PHPUnit questions here


The #phpunit channel on the Freenode IRC network is a place to chat about PHPUnit.

List of Contributors

Thanks to everyone who has contributed to PHPUnit! You can find a detailed list of contributors on every PHPUnit related package on GitHub. This list shows only the major components:

A very special thanks to everyone who has contributed to the documentation and helps maintaining the translations:

Please refer to for information on how to contribute to PHPUnit and its related projects.