talira

The testing framework for PHP

open sourceBSD-3-Clausefree

PHPUnit is the standard unit testing framework for PHP, made by Sebastian Bergmann. You write tests as classes extending TestCase with assertions, and its command-line runner finds and runs them, with data providers for parameterized tests, test dependencies, test doubles and mock objects, attributes for configuration, code coverage reports and JUnit-format logs for CI. It installs per project with Composer (phpunit/phpunit) or as a self-contained PHAR, also through Phive. A new major version comes out each February: PHPUnit 13, released in February 2026, needs PHP 8.4 or newer, and older majors keep bugfix support for PHP versions they cover.

Ways to install

Package managers

Problems it solves

  • write unit tests for my PHP code
  • run my PHP test suite in CI and get a coverage report
  • mock a dependency in a PHP unit test

Features

  • TestCase classes with assertions
  • data providers and test dependencies
  • test doubles and mock objects
  • attributes to configure tests
  • code coverage reports
  • JUnit XML logging for CI
  • Composer package or self-contained PHAR (also via Phive)
  • PHPT tests