
PHPUnit
PHPUnit is a testing framework for PHP, with a command-line runner for running tests and selecting suites.
What PHPUnit is
PHPUnit is a testing framework for PHP, with a command-line runner for running tests and selecting suites. It supports assertions for return values, exceptions, side effects, output, error logs, files, JSON and XML. Tests can be organized through filesystem structure or XML configuration, and can use data providers, dependencies, stubs and mock objects. PHPUnit also documents code coverage reports in HTML and JSONL formats, along with JUnit and TeamCity logging configuration. To address unstable tests, it can repeat or retry runs using attributes or command-line options. Installation is available as a PHAR or a Composer development dependency. PHPUnit 13 is the current stable major version and requires PHP 8.4 or later. Bug-fix support for version 13 is listed through February 4, 2028, while its end-of-life date is undetermined. Documentation is available for supported versions 8.5 through 13.4, and the getting-started guide teaches writing and running simple unit tests. PHPUnit is free and supports Linux, macOS, Windows and self-hosted use.
Good
- Free framework with PHAR and Composer installation options.
- Supports data providers, dependencies, stubs and mocks.
- Provides HTML and JSONL coverage reports.
- Can retry or repeat tests.
Watch out
- PHPUnit 13 requires PHP 8.4 or later.
- End-of-life date for PHPUnit 13 is undetermined.
Who it suits
PHP developers looking for a framework to write and run tests may find PHPUnit suitable. Its assertions, test doubles and coverage reports support a range of testing needs.
Verdict
PHPUnit offers a broad set of test assertions and reporting options for PHP projects. Check the PHP 8.4 requirement if considering the current stable major version.
Plans and prices
From PHPUnit's own pricing page, checked 4 Oct 2026.
| Plan | Price | What it gives you |
|---|---|---|
| PHPUnit | Free | PHP testing framework · download as PHAR or install per project with Composer |
The facts
Each one read from PHPUnit's own pages, with the date it was checked.
What it does
- Assertions
- The manual documents assertions for values, exceptions, side effects, output, files, JSON, and XML.checked 4 Oct 2026
- Audience
- The getting-started guide teaches writing simple unit tests and running them for PHP code.checked 4 Oct 2026
- Code coverage
- The manual documents code coverage reports in HTML and JSONL formats.checked 4 Oct 2026
- Coverage and reports
- The manual documents code coverage, HTML and JSONL coverage reports, and JUnit and TeamCity logging configuration.checked 3 Oct 2026
- Current PHP requirement
- The current stable major version is PHPUnit 13, which requires PHP 8.4 or later.checked 3 Oct 2026
- Current release
- PHPUnit 13 is listed as the current stable major version.checked 4 Oct 2026
- Flaky tests
- PHPUnit supports repeating and retrying tests, including through attributes and command-line options.checked 3 Oct 2026
- Installation
- PHPUnit 13 can be downloaded as a PHAR archive or installed as a per-project development dependency with Composer.checked 4 Oct 2026
- Maintainer
- The site identifies Sebastian Bergmann as responsible for the website and its editorial content, with an address in Siegburg, Germany.checked 4 Oct 2026
- Maintainer and sponsorship
- Sebastian Bergmann is PHPUnit's creator and lead maintainer, and says he reviews and validates every change; sponsorship does not buy influence over the roadmap.checked 3 Oct 2026
- PHP requirement
- PHPUnit 13 requires PHP 8.4 or later.checked 4 Oct 2026
- Purpose
- PHPUnit is a testing framework for PHP.checked 4 Oct 2026
- Release support
- PHPUnit 13 receives bug-fix support through February 4, 2028; its end-of-life date is undetermined.checked 3 Oct 2026
- Security
- The getting-started page links to documentation for verifying PHPUnit PHAR releases.checked 4 Oct 2026
- Security verification
- The getting-started page directs users to documentation for verifying PHPUnit PHAR releases.checked 3 Oct 2026
- Support policy
- PHPUnit 13 bugfix support is listed through February 4, 2028, and its end-of-life date is to be determined.checked 4 Oct 2026
- Support versions
- The site provides documentation for supported PHPUnit versions 8.5 through 13.4.checked 4 Oct 2026
- Test assertions
- The manual covers tests for return values, exceptions, side effects, output, and error log output.checked 3 Oct 2026
- Test doubles
- The framework supports test stubs and mock objects.checked 4 Oct 2026
- Test execution
- PHPUnit provides a command-line test runner for running tests and selecting test suites.checked 4 Oct 2026
- Test organization
- Tests can use data providers and dependencies, and can be organized using the filesystem or XML configuration.checked 3 Oct 2026
- Test stability
- PHPUnit supports repeating and retrying tests to work with flaky tests.checked 4 Oct 2026
The company
- Headquarters
- The site's legal notice lists Sebastian Bergmann at an address in Siegburg, Germany.checked 3 Oct 2026
The full review of PHPUnit
PHPUnit is a free testing framework for PHP developers who want to write and run project-level tests from the command line. It is a strong fit for PHP codebases that need a broad set of assertions and reporting options, but PHPUnit 13’s PHP 8.4 minimum makes compatibility the first thing to check.
Overview
PHPUnit provides a framework for developer-side testing, from organizing test cases to running selected suites with a command-line runner. Tests can be organized through the filesystem or XML configuration, with data providers for parameterized cases and dependencies for related tests. That flexibility suits projects with established test structures, though PHPUnit is purpose-built for PHP rather than a general testing service.
Install it as a PHAR or as a Composer development dependency. For the PHAR route, PHPUnit’s getting-started guidance points to instructions for verifying releases, a useful step when checking the integrity of a downloaded executable.
PHPUnit 13 is the current stable major version and requires PHP 8.4 or later. It receives bug-fix support through February 4, 2028; its end-of-life date is undetermined. Documentation covers supported versions 8.5 through 13.4, which gives teams maintaining older PHP projects a version-specific reference.
Key features
Assertions and test organization
Assertions cover values, exceptions, side effects, output, files, JSON, XML, and error-log output. In practice, that lets a PHP team express varied expected behavior within the same framework instead of limiting tests to return values. Data providers make it possible to run cases against multiple inputs, while dependencies can connect tests when one relies on another.
Test doubles, coverage, and stability
PHPUnit supports stubs and mock objects, giving developers tools to isolate code from dependencies. Its documented coverage reports are available in HTML and JSONL, and logging can be configured for JUnit and TeamCity. These options suit teams that need readable coverage output or test results in those formats.
Repeating and retrying tests, through attributes or command-line options, can help teams work with flaky tests. Retries can make unstable tests easier to manage, but they do not remove the underlying source of test instability.
Pricing
PHPUnit is free: the PHPUnit plan costs nothing. It includes the PHP testing framework, with installation as a PHAR or per-project through Composer. There is no free trial because the framework is already free, and there are no paid tiers or seat-based plans to weigh.
Platforms
PHPUnit supports Linux, macOS, Windows, and self-hosted environments. PHP is its supported language, so it is not the right choice for testing code written in another language.
Who it's for
PHP developers who want a free framework for running structured tests, using test doubles, and generating coverage reports will find PHPUnit a well-rounded option. It is less suitable for projects that cannot run PHP 8.4 or later but want the current stable major version, or for teams seeking one testing tool across different programming languages.
Pros and cons
- Broad assertion coverage: Tests can check values, exceptions, side effects, output, files, JSON, XML, and error logs.
- Flexible test setup: Data providers, dependencies, filesystem organization, and XML configuration accommodate different testing patterns.
- Useful reporting choices: HTML and JSONL coverage reports and JUnit and TeamCity logging support several reporting needs.
- Free distribution options: Developers can install the framework as a PHAR or as a Composer development dependency, with no plan cost.
- Current-version compatibility constraint: PHPUnit 13 requires PHP 8.4 or later, which rules it out for projects on older PHP versions.
- Language-specific scope: PHPUnit is for PHP, not teams looking for a shared framework across languages.
Alternatives
Browse unit testing frameworks to compare options by category. Choose QUnit instead for JavaScript testing, with distribution through a CDN, npm, or Yarn. Kotest is a free alternative whose test framework, assertions library, and property testing are standalone projects that can be used independently.
NUnit is another free framework to consider. For a free option with stated support for PHP 8.4 and later in its fifth major version, compare Pest. Vitest is also free; Rust libtest is built into Rust’s standard-library test harness. For Scala projects, consider the free libraries ScalaCheck or ScalaTest.
Verdict
PHPUnit is a strong choice for PHP developers who want a free, established testing framework with varied assertions, test doubles, coverage reports, and command-line control. Its clearest reason to choose is the breadth of the PHP testing workflow it supports; its clearest reason to look elsewhere is the PHP 8.4 requirement for version 13, or the need to test another language.
Alternatives to PHPUnit
- 1

QUnit
Free planAndroidiOSWebAPI7.4Free plan - 2

NUnit
Free planAndroidiOSAPILinux6.8Free plan - 3
Kotest
Free planAndroidiOSWebLinux6.7Free plan - 4
ScalaCheck
Free planLinuxmacOSWindows6.6Free plan - 5

Vitest
Free planWebLinuxmacOSWindows6.6Free plan - 6

Boost.Test
Free planLinuxWindows6.5Free plan
