https://github.com/mezzio/mezzio
PSR-15 Middleware Microframework
https://github.com/mezzio/mezzio
middleware middleware-framework psr-15
Last synced: about 1 year ago
JSON representation
PSR-15 Middleware Microframework
- Host: GitHub
- URL: https://github.com/mezzio/mezzio
- Owner: mezzio
- License: bsd-3-clause
- Created: 2019-12-31T20:49:35.000Z (over 6 years ago)
- Default Branch: 3.22.x
- Last Pushed: 2025-05-12T08:01:08.000Z (about 1 year ago)
- Last Synced: 2025-05-12T09:27:37.965Z (about 1 year ago)
- Topics: middleware, middleware-framework, psr-15
- Language: PHP
- Homepage: https://docs.mezzio.dev/mezzio/
- Size: 12.7 MB
- Stars: 353
- Watchers: 33
- Forks: 52
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-rainmana - mezzio/mezzio - PSR-15 Middleware Microframework (PHP)
- awesome-php - Mezzio - PSR-15 Middleware Microframework (BSDv3) (Table of Contents / Framework)
README
# mezzio
[](https://github.com/mezzio/mezzio/actions?query=workflow%3A"Continuous+Integration")
[](https://shepherd.dev/github/mezzio/mezzio)
*Develop PSR-7 middleware applications in minutes!*
mezzio builds on [laminas-stratigility](https://github.com/laminas/laminas-stratigility)
to provide a minimalist PSR-7 middleware framework for PHP, with the following
features:
- Routing. Choose your own router; we support:
- [FastRoute](https://github.com/nikic/FastRoute)
- [laminas-router](https://github.com/mezzio/mezzio-router)
- DI Containers, via [PSR-11 Container](https://github.com/php-fig/container).
Middleware matched via routing is retrieved from the composed container.
- Optionally, templating. We support:
- [Plates](http://platesphp.com/)
- [Twig](http://twig.sensiolabs.org/)
- [Laminas's PhpRenderer](https://github.com/laminas/laminas-view)
## Installation
We provide two ways to install Mezzio, both using
[Composer](https://getcomposer.org): via our
[skeleton project and installer](https://github.com/mezzio/mezzio-skeleton),
or manually.
### Using the skeleton + installer
The simplest way to install and get started is using the skeleton project, which
includes installer scripts for choosing a router, dependency injection
container, and optionally a template renderer and/or error handler. The skeleton
also provides configuration for officially supported dependencies.
To use the skeleton, use Composer's `create-project` command:
```bash
composer create-project mezzio/mezzio-skeleton
```
This will prompt you through choosing your dependencies, and then create and
install the project in the `` (omitting the `` will
create and install in a `mezzio-skeleton/` directory).
### Manual Composer installation
You can install Mezzio standalone using Composer:
```bash
composer require mezzio/mezzio
```
However, at this point, Mezzio is not usable, as you need to supply
minimally:
- a router.
- a dependency injection container.
We currently support and provide the following routing integrations:
- [FastRoute](https://github.com/nikic/FastRoute):
`composer require mezzio/mezzio-fastroute`
- [laminas-router](https://github.com/mezzio/mezzio-router):
`composer require mezzio/mezzio-laminasrouter`
We recommend using a dependency injection container, and typehint against
[PSR-11 Container](https://github.com/php-fig/container). We
can recommend the following implementations:
- [laminas-servicemanager](https://github.com/laminas/laminas-servicemanager):
`composer require laminas/laminas-servicemanager`
- [Pimple](https://github.com/silexphp/Pimple) (see [docs](docs/book/features/container/pimple.md) for more details):
`composer require laminas/laminas-pimple-config`
- [Aura.Di](https://github.com/auraphp/Aura.Di) (see [docs](docs/book/features/container/aura-di.md) for more details):
`composer require laminas/laminas-auradi-config`
Additionally, you may optionally want to install a template renderer
implementation, and/or an error handling integration. These are covered in the
documentation.
## Documentation
Documentation is [in the doc tree](docs/book/), and can be compiled using [mkdocs](https://www.mkdocs.org):
```bash
mkdocs build
```
Additionally, public-facing, browseable documentation is available at