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).
PHPUnit should be installed using the PEAR Installer, the backbone of the PHP Extension and Application Repository that provides a distribution system for PHP packages.
Depending on your OS distribution and/or your PHP environment, you may need to install PEAR or update your existing PEAR installation before you can proceed with the following instructions.
sudo pear upgrade PEAR usually suffices to upgrade an existing PEAR installation. The PEAR Manual explains how to perform a fresh installation of PEAR.
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 pear.phpunit.de/PHPUnit
After the installation you can find the PHPUnit source files inside your local PEAR directory; the path is usually
The documentation for PHPUnit is available in different formats:
- English, multiple HTML files
- English, single HTML file
- English, PDF
- English, ePub
- French, multiple HTML files
- French, single HTML file
- French, PDF
- French, ePub
- Japanese, multiple HTML files
- Japanese, single HTML file
- Japanese, PDF
- Japanese, ePub
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 CONTRIBUTING.md for information on how to contribute to PHPUnit and its related projects.