GitHub - mezzio/mezzio: PSR-15 Middleware Microframework
source link: https://github.com/mezzio/mezzio
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
README.md
mezzio
Develop PSR-7 middleware applications in minutes!
mezzio builds on laminas-stratigility to provide a minimalist PSR-7 middleware framework for PHP, with the following features:
- Routing. Choose your own router; we support:
- DI Containers, via PSR-11 Container. Middleware matched via routing is retrieved from the composed container.
- Optionally, templating. We support:
Installation
We provide two ways to install Mezzio, both using Composer: via our skeleton project and installer, 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:
$ composer create-project mezzio/mezzio-skeleton <project dir>
This will prompt you through choosing your dependencies, and then create and
install the project in the <project dir>
(omitting the <project dir>
will
create and install in a mezzio-skeleton/
directory).
Manual Composer installation
You can install Mezzio standalone using Composer:
$ 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:
- Aura.Router:
composer require mezzio/mezzio-aurarouter
- FastRoute:
composer require mezzio/mezzio-fastroute
- laminas-router:
composer require mezzio/mezzio-laminasrouter
We recommend using a dependency injection container, and typehint against PSR-11 Container. We can recommend the following implementations:
- laminas-servicemanager:
composer require laminas/laminas-servicemanager
- Pimple (see docs for more details):
composer require laminas/laminas-pimple-config
- Aura.Di (see docs 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, and can be compiled using mkdocs:
$ mkdocs build
Additionally, public-facing, browseable documentation is available at https://docs.mezzio.dev/mezzio/
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK