Download the PHP package hannesvdvreken/psr7-middlewares without Composer
On this page you can find all versions of the php package hannesvdvreken/psr7-middlewares. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package psr7-middlewares
No longer maintained
Create callable middlewares instead. Signature:
PSR-7 middlewares
Stackable middlewares for PSR-7 HTTP message objects.
Installation
Description
This package is a small library that helps you to construct a decorated array of middlewares.
There are 2 types of middlewares:
A Kernel
, which is a middleware which can pass on the Request and Response object to the next layer.
A Core
object is usually the last layer of a list of middlewares.
A core will always return a PSR-7 ResponseInterface
object and never pass on
the given RequestInterface
object to a next layer. It will never have a next middleware set.
The Builder
object helps in creating a composed Core
which consists of a specified list of layers.
Note that the builder object is immutable:
thus it returns a different mutated object after each push
and unshift
call.
The returned Stack
object can also be created with the static factory method create
.
The Stack object itself is also a Core middleware, so it can be used in a different composition of middlewares. This is how you can send a Request object through the different layers of middlewares:
Extending
Creating a Core yourself:
Creating a Kernel:
Middlewares
Existing
- League/route application core
Ideas for more middlewares
- Robots middleware. To return an environment specific robots.txt file.
- Any type of framework application
- Throttle middleware
- CORS middleware
- Cache middleware
- IP based Firewall middleware
- Logger middleware
Contributing
Contributions are welcome. See the contributions file to know how to contribute.
License
The MIT License (MIT). Please see License File for more information.