PHPUnit

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

Framework
Composer
v13.3.3
20,055 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

PHP
82%
Other

Akaunting

Invoicing Finance

10,123

Open-source online accounting for small businesses and freelancers — invoices, expenses, and reporting without monthly fees or vendor lock-in.

View details
98
Repo Health
73
Technical
63
Dependency
Built with
PHP 82%
Blade 13%
Updated 1 weeks ago
TypeScript
62%
BSD 3

Appwrite

Authentication · Databases · Developer Tools

57,368

Open-source backend platform with Auth, Databases, Storage, Functions, Messaging, Realtime, and Sites — deploy via Docker or use Appwrite Cloud.

View details
92
Repo Health
81
Technical
65
Dependency
Built with
TypeScript 62%
PHP 37%
Updated 1 weeks ago
PHP
73%
MIT

Bagisto

Analytics · Ecommerce

28,117

Open-source Laravel eCommerce platform for building multi-vendor marketplaces, B2B stores, headless commerce, and AI-powered storefronts.

View details
92
Repo Health
75
Technical
68
Dependency
Built with
PHP 73%
Blade 21%
Updated 1 weeks ago
PHP
63%
Other

BillaBear

Ecommerce · Invoicing Finance

760

Self-hostable subscription management and billing platform with Stripe integration, tax automation, configurable workflows, and Twig-based document generation.

View details
77
Repo Health
66
Technical
65
Dependency
Built with
PHP 63%
Vue 18%
Gherkin 13%
Updated 1 weeks ago
PHP
78%
Other

Craft CMS

CMS

3,608

A developer-first PHP CMS with clean-slate content modeling, auto-generated GraphQL API, and a four-tier edition system that scales from solo projects to enterprise deployments.

View details
96
Repo Health
83
Technical
62
Dependency
Built with
PHP 78%
JavaScript 14%
Updated 1 weeks ago
PHP
48%
AGPL 3.0

Crater

Invoicing Finance

8,347

Open source invoicing and billing platform for freelancers and small businesses — create estimates, track expenses, accept Stripe payments, and run recurring invoices from your own server.

View details
54
Repo Health
68
Technical
69
Dependency
Built with
PHP 48%
Vue 40%
Updated 2 years ago
PHP
66%
AGPL 3.0

EspoCRM

CRM · Ecommerce · Marketing

3,354

Open-source CRM platform with metadata-driven customization, field-level permissions, and a full REST API — deploy on your own infrastructure.

View details
97
Repo Health
72
Technical
63
Dependency
Built with
PHP 66%
JavaScript 23%
Updated 1 weeks ago
TypeScript
75%
Apache 2.0

Fern

Developer Tools

3,779

Fern turns a single OpenAPI, AsyncAPI, or Protobuf definition into type-safe SDKs for nine languages and a hosted API documentation site, all from one CLI and one source of truth.

View details
90
Repo Health
86
Technical
66
Dependency
Built with
TypeScript 75%
Updated 1 weeks ago
Vue
54%
GPL 3.0

Financial Freedom

Invoicing Finance

2,922

Own your financial data with a self-hosted, privacy-first budgeting app that replaces Mint and YNAB.

View details
48
Repo Health
67
Technical
74
Dependency
Built with
Vue 54%
PHP 44%
Updated 4 months 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