bauhaus/middleware-chain

PSR-15 middleware chain

v0.0.0 2017-05-31 02:59 UTC

This package is auto-updated.

Last update: 2024-10-23 17:34:44 UTC


README

Build Status Coverage Status Codacy Badge

Latest Stable Version Latest Unstable Version Total Downloads License composer.lock available

Bauhaus Middleware Chain

This package helps you to build a PSR-15 Middleware chain to process PSR-7 Server Requests and get PSR-7 Response.

<?php

use Bauhaus\MiddlewareChain;
use SomeVendor\Middleware1;
use AnotherVendor\Middleware2;

$diContainer = require_once 'diContinaer.php'; // Psr\Container\ContainerInterface
$request = require_once 'request.php';

$chain = new Chain($diContainer);

$chain->stackUp(new Middleware1());
$chain->stackUp(Middleware2::class); // This will be loaded with $diContainer->get(Middleware2::class)

$response = $chain->handle($request);