PHPUnit

The de facto standard, programmer-oriented unit testing framework for PHP.

Framework
Composer
v13.4.3
20,072 stars
BSD 3-Clause License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
92 /100 Excellent
Development Activity 100
Maintenance 84
Community 84
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
88 /100 Excellent
Architecture 92
Code Quality 96
Innovation 82
Learning Curve 80

PHPUnit is the most widely used testing framework in the PHP ecosystem, an instance of the xUnit architecture that gives developers a structured way to write, organize, and run automated tests. It provides a TestCase base class, a comprehensive assertion API, test doubles (mocks and stubs), data providers, and fixtures, plus a full-featured command-line runner for executing suites and reporting results.

Beyond running tests, PHPUnit integrates code-coverage analysis, rich event and logging subsystems, and configuration via XML, making it the backbone of continuous-integration pipelines for millions of PHP projects.

What You Get

  • A TestCase base class with a large, expressive assertion API
  • Built-in test doubles: mocks, stubs, and spies
  • Data providers and fixtures for parameterized and shared-setup tests
  • A powerful CLI runner with filtering, grouping, and parallel-friendly output
  • Integrated code-coverage reporting and multiple logging/result formats

Common Use Cases

  • Writing and running unit tests for PHP classes and functions
  • Enforcing test coverage thresholds in CI pipelines
  • Mocking collaborators to test units in isolation
  • Driving test-driven development for PHP applications and libraries

Under The Hood

Architecture - PHPUnit is organized into clear subsystems under src/: Framework holds TestCase, assertions, and constraints; Runner and TextUI implement test discovery, configuration, and the CLI entry point (bin/phpunit); Event provides a typed event bus that decouples the runner from logging and reporting; Metadata parses attributes and annotations; and Logging emits JUnit/TestDox and other report formats. Tests are collected into suites and executed through the runner, which dispatches lifecycle events consumed by subscribers.

Tech Stack - Pure PHP requiring PHP >= 8.4.1 and a set of extensions (dom, libxml, mbstring, xmlwriter). It composes many focused sebastian/* and phpunit/* packages (php-code-coverage, comparator, diff, exporter, global-state), reflecting a strongly modular design where each concern is its own library.

Code Quality - The project is exceptionally mature and rigorously tested against its own suite, with codecov-tracked coverage, strict typing, and a large contributor base. Its long history (an instance of xUnit dating back over two decades) and disciplined release cadence make it a reference example of PHP engineering quality.

API Design - The public API is highly ergonomic and consistent: assertions read naturally (assertSame, assertInstanceOf), test doubles are created through a fluent builder, and attributes now express metadata cleanly. Extensive official documentation and near-universal community familiarity make the learning curve gentle for basic use, though advanced features like custom constraints and the event system reward deeper study.

Used by 34 apps in this directory

TypeScript
72%
AGPL 3.0

Firecrawl

AI Development · Developer Tools

194,745

Turn any website into clean, LLM-ready data with a single API call — no proxy headaches, no scraping complexity.

View details
89
Repo Health
83
Technical
65
Dependency
Built with
TypeScript 72%
Python 12%
Updated 5 days ago
JavaScript
72%
AGPL 3.0

Fleetbase

Logistics

4,390

Modular open-source logistics and supply chain operating system

View details
93
Repo Health
75
Technical
68
Dependency
Built with
JavaScript 72%
Updated 6 days ago
PHP
91%
AGPL 3.0

FreeScout

Customer Support

4,611

Run your own help desk and shared inbox — a fully self-hosted, open-source alternative to Zendesk and Help Scout with no per-agent fees.

View details
92
Repo Health
55
Technical
63
Dependency
Built with
PHP 91%
Updated 6 days ago
PHP
57%
Other

Hi.Events

Ecommerce · Scheduling

4,074

Self-hosted event ticketing platform that keeps your attendee data, brand, and revenue completely under your control.

View details
90
Repo Health
84
Technical
67
Dependency
Built with
PHP 57%
TypeScript 37%
Updated 5 days ago
PHP
60%
AGPL 3.0

Hyvor Relay

AI Development · Devops · Monitoring

918

Self-hosted, open-source email API that automates DNS, manages SMTP delivery, and provides deep observability — replacing SES, Mailgun, and SendGrid with infrastructure you fully own.

View details
69
Repo Health
79
Technical
71
Dependency
Built with
PHP 60%
Svelte 22%
Go 16%
Updated 1 weeks ago
PHP
84%
Other

Invoice Ninja

Invoicing Finance · Project Management

10,311

Self-hostable invoicing, time-tracking, and multi-gateway payment platform for freelancers and small businesses, with built-in e-invoicing compliance for EU and global standards.

View details
97
Repo Health
83
Technical
62
Dependency
Built with
PHP 84%
Updated 1 weeks ago
PHP
87%
AGPL 3.0

Kimai

Invoicing Finance · Project Management

5,095

Professional open-source time tracking with invoicing, multi-user support, SAML/LDAP auth, and a full REST API—self-host it or use the cloud.

View details
94
Repo Health
78
Technical
64
Dependency
Built with
PHP 87%
Updated 5 days ago
PHP
51%
MIT

Krayin CRM

CRM · Ecommerce

24,049

Free, open-source Laravel & Vue.js CRM for SMEs and enterprises to manage the complete customer lifecycle.

View details
90
Repo Health
68
Technical
67
Dependency
Built with
PHP 51%
Blade 41%
Updated 1 weeks ago
JavaScript
42%
Other

LimeSurvey

Forms Surveys

3,778

The world's most flexible open-source survey platform with 900+ templates, conditional logic, 80+ languages, and full GDPR compliance for any scale.

View details
86
Repo Health
62
Technical
62
Dependency
Built with
JavaScript 42%
PHP 36%
CSS 12%
Updated 5 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers