Welcome to Mw’s documentation!¶
The Mw library is a very flexible framework for converting middleware into handlers. Middleware offer a clean syntax for implementing the [Decorator Pattern](https://en.wikipedia.org/wiki/Decorator_pattern)
Middleware provide a great system for extendable features and the Krak\Mw library offers a simple yet powerful implementation to create middleware at ease.
<?php
use Krak\Mw;
$handler = mw\compose([
function($a, $next) {
return strtoupper($a);
},
function($a, $next) {
return $next('x' . $a . 'x');
}
]);
$res = $handler('abc');
// $res == 'xABCx'