2017 © Pedro Peláez
 

library middleware-request-handler

Minimalist PSR-15 middleware based request handler (dispatcher)

image

jerowork/middleware-request-handler

Minimalist PSR-15 middleware based request handler (dispatcher)

  • Wednesday, February 7, 2018
  • by jerowork
  • Repository
  • 2 Watchers
  • 2 Stars
  • 61 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 3 % Grown

The README.md

Middleware request handler

Minimalist PSR-15 middleware based request handler (dispatcher)., (*1)

Installation

Install via Composer:, (*2)

$ composer require jerowork/middleware-request-handler

Usage

Use with a PSR-7 request implementation, like Zend Diactoros., (*3)

Example

use Jerowork\MiddlewareDispatcher\Middleware\FinalResponseMiddleware;
use Jerowork\MiddlewareDispatcher\MiddlewareRequestHandler;
use Zend\Diactoros\Response;
use Zend\Diactoros\Response\SapiEmitter;
use Zend\Diactoros\ServerRequestFactory;

// Setup a list of PSR-15 middlewares
$middlewares = [
    new SomeMiddleware(),
    new AnotherMiddleware()
];

// Setup request handler
$handler = new MiddlewareRequestHandler($middlewares);

// Add other middlewares after construct
$handler->addMiddleware(
    new ThirdMiddleware(),
    new FourthMiddleware()
);

// Add final reversal order middleware
$handler->addMiddleware(new FinalResponseMiddleware(new Response());

// Handle a PSR-7 server request to response by the request handler (PSR-15)
$response = $handler->handle(ServerRequestFactory::fromGlobals());

// Output PSR-7 response with a response emitter implementation of your choice
(new SapiEmitter())->emit($response);

The Versions

07/02 2018

dev-master

9999999-dev

Minimalist PSR-15 middleware based request handler (dispatcher)

  Sources   Download

MIT

The Requires

 

The Development Requires

middleware psr-7 dispatcher psr-15 request handler

07/02 2018

0.4.0

0.4.0.0

Minimalist PSR-15 middleware based request handler (dispatcher)

  Sources   Download

MIT

The Requires

 

The Development Requires

middleware psr-7 dispatcher psr-15 request handler

06/02 2018

0.3.0

0.3.0.0

Minimalist PSR-15 middleware based request handler (dispatcher)

  Sources   Download

MIT

The Requires

 

The Development Requires

middleware psr-7 dispatcher psr-15 request handler

23/01 2018

0.2.1

0.2.1.0

Minimalist PSR-15 middleware based request handler (dispatcher)

  Sources   Download

MIT

The Requires

 

middleware psr-7 dispatcher psr-15 request handler

23/01 2018

0.2.0

0.2.0.0

Minimalist PSR-15 middleware based request handler (dispatcher)

  Sources   Download

MIT

The Requires

 

middleware psr-7 dispatcher psr-15 request handler

19/11 2017

0.1.0

0.1.0.0

Minimalist PSR-15 middleware based request handler (dispatcher)

  Sources   Download

MIT

The Requires

 

middleware psr-7 dispatcher psr-15 request handler