ellipse / middleware
Psr-15 middleware stack and queue
1.0.1
2018-03-19 16:02 UTC
Requires
- php: >=7.0
- ellipse/handlers: ^1.0
- ellipse/type-errors: ^1.0
- psr/http-message: ^1.0
- psr/http-server-handler: ^1.0
- psr/http-server-middleware: ^1.0
Requires (Dev)
- eloquent/phony-kahlan: ^1.0
- kahlan/kahlan: ^4.0
This package is auto-updated.
Last update: 2024-11-26 01:21:44 UTC
README
This package provides classes for Psr-15 middleware stack and queue, allowing to group multiple middleware together.
Require php >= 7.0
Installation composer require ellipse/middleware
Run tests ./vendor/bin/kahlan
Middleware stack
This package provides an Ellipse\Middleware\MiddlewareStack
class allowing create a middleware processing the request using many middleware in LIFO order.
<?php namespace App; use Ellipse\Middleware\MiddlewareStack; // Create a middleware stack. (LIFO order) $stack = new MiddlewareStack([new SomeMiddleware2, new SomeMiddleware1]); // The request goes through middleware1, middleware2, then hit the request handler. $response = $stack->process($request, new SomeHandler);
Middleware queue
This package provides an Ellipse\Middleware\MiddlewareQueue
class allowing create a middleware processing the request using many middleware in FIFO order.
<?php namespace App; use Ellipse\Middleware\MiddlewareQueue; // Create a middleware queue. (FIFO order) $queue = new MiddlewareQueue([new SomeMiddleware1, new SomeMiddleware2]); // The request goes through middleware1, middleware2, then hit the request handler. $response = $queue->process($request, new SomeHandler);