Download the PHP package phossa2/middleware without Composer
On this page you can find all versions of the php package phossa2/middleware. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phossa2/middleware
More information about phossa2/middleware
Files in phossa2/middleware
Package middleware
Short Description Another cool middleware runner library for PHP.
License MIT
Homepage https://github.com/phossa2/middleware
Informations about the package middleware
phossa2/middleware [ABANDONED]
PLEASE USE phoole/middleware library instead
phossa2/middleware is another cool middleware runner library for PHP.
It requires PHP 5.4, supports PHP 7.0+ and HHVM. It is compliant with PSR-1, PSR-2, PSR-3, PSR-4, PSR-7 and the proposed PSR-5
Why another middleware runner ?
-
It was started to be a PSR-15 compatible middleware runner. But we don't like the single-pass approach of PSR-15. So it turns out to be a double-pass and PSR-15ish library.
-
Adopted nice feature of
condition
from woohoolabs/harmony. But we don't agree its tight-binding with dispatcher. - A couple of cool features unique to this library.
Installation
Install via the composer
utility.
or add the following lines to your composer.json
Features
-
Able to use most of the double-pass middlewares out there.
-
Able to use a middleware queue (a group of middlewares) as a generic middleware in another(or the main) queue.
-
Able to conditionally execute a middleware or a sub queue base on a condition.
- Able to branching into a subqueue and terminate when the subqueue finishes.
Usage
Create the middleware queue, then process all the middlewares.
Or push middlewares to the queue after its instantiation,
Advanced
-
Compatibility with PSR-7 middlewares.
PSR-7 double-pass middleware with the following signature is supported,
Lots of middlewares out there then can be used without modification, such as psr7-middlewares.
-
Phossa2\Middleware\Queue
implements thePhossa2\Middleware\Interfaces\MiddlewareInterface
, so the queue itself can be used as a generic middleware. -
A
condition
is a callable with the signature of,Or an instanceof
Phossa2\Middleware\Interfaces\ConditionInterface
.A condition can be attached to a middleware or a subqueue. And the middleware will be executed only if the condition is evaluated to
TRUE
. -
Subqueue termination - branching
Sometimes, user wants the whole middleware processing terminate right after a subqueue finishes instead of continue processing the parent queue.
Change log
Please see CHANGELOG from more information.
Testing
Contributing
Please see CONTRIBUTE for more information.
Dependencies
-
PHP >= 5.4.0
-
phossa2/shared >= 2.0.21
- A PSR-7 HTTP message implementation, such as zend-diactoros
License
All versions of middleware with dependencies
psr/http-message-implementation Version ^1.0.0
container-interop/container-interop Version ~1.0
phossa2/shared Version ^2.0.21