Mezzio

A minimalist PSR-7/PSR-15 middleware microframework for building PHP web applications and APIs.

Framework
Composer
v3.28.1
396stars
BSD 3-Clause License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
80/100Excellent
Development Activity76
Maintenance80
Community84
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
72/100Good
Architecture82
Code Quality80
Innovation65
Learning Curve60

Mezzio (formerly Zend Expressive) is a PSR-15 middleware microframework built on top of laminas-stratigility. Rather than dictating a monolithic MVC structure, it composes a PSR-7 request/response cycle out of routable middleware, letting developers choose their own router (FastRoute or laminas-router), PSR-11 dependency injection container (laminas-servicemanager, Pimple, Aura.Di, and others), and optional templating engine (Plates, Twig, or laminas-view).

Applications are typically bootstrapped via the mezzio/mezzio-skeleton Composer installer, which interactively selects these pluggable pieces at project creation time. This à-la-carte architecture makes Mezzio a good fit for teams that want PSR-standard middleware composition without committing to a specific router, container, or templating implementation.

What You Get

  • An Application class that composes and dispatches PSR-15 middleware pipelines
  • Pluggable routing via FastRoute or laminas-router, resolved through your chosen adapter
  • PSR-11 container integration for retrieving middleware/handlers by service name
  • Optional templating support for Plates, Twig, or laminas-view via adapter packages
  • The mezzio-skeleton installer for interactively scaffolding a new project with chosen dependencies

Common Use Cases

  • Building lightweight PSR-15 middleware-based REST APIs without a full-stack MVC framework
  • Composing cross-cutting concerns (auth, logging, error handling) as reusable middleware layers
  • Migrating legacy Zend Expressive applications onto actively maintained Laminas-ecosystem tooling
  • Building modular PHP applications where routing, DI, and templating choices are made independently

Under The Hood

Architecture - Mezzio’s Application class extends laminas-stratigility’s middleware pipeline (MiddlewarePipe), registering routed middleware/handlers that are resolved lazily from a PSR-11 container at dispatch time. Routing itself is delegated to a RouterInterface adapter (FastRoute or laminas-router), so the framework’s core stays router-agnostic while still providing a consistent Router\Route/RouteResult abstraction across adapters — a layered design that trades a bundled ‘batteries included’ feel for maximum composability.

Tech Stack - Built on PSR-7 (HTTP messages), PSR-15 (middleware/handlers), and PSR-11 (containers) standard interfaces, with laminas-stratigility providing the underlying pipeline mechanics. It ships as a Composer package with PSR-4 autoloading and depends on adapter packages (mezzio-fastroute, laminas-servicemanager, etc.) supplied separately per project.

Code Quality - With 2,930 commits from 116 contributors and 42 tagged releases, Mezzio is a mature, actively maintained framework (6.67 commits/month). It maintains PHPUnit test coverage, Psalm static analysis tracked via Shepherd, and GitHub Actions CI, consistent with the broader Laminas project’s engineering standards.

API Design - Getting started requires deliberately explicit choices — a router, a container, and configuration wiring — rather than framework magic, which the mezzio-skeleton installer streamlines via an interactive prompt. Once configured, defining a route is a small, declarative call ($app->get('/path', HandlerClass::class)), keeping day-to-day usage low-boilerplate even though initial setup requires more decisions than an all-in-one framework.

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

Search