Collection of PSR-15 middlewares
Switch branches/tags
Nothing to show
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
art deleted the explanation and inserted the logo in the readme Jan 27, 2018
.editorconfig some changes and typos Oct 11, 2016
.gitattributes first version Oct 10, 2016 first version Oct 10, 2016
LICENSE added reporting-logger middleware Jun 7, 2018 added reporting-logger middleware Jun 7, 2018



Collection of PSR-15 middlewares


Usage example

use Zend\Diactoros\ServerRequestFactory;
use Middlewares\Utils\Dispatcher;
use Middlewares;

$dispatcher = new Dispatcher([

    //Handle errors
    (new Middlewares\ErrorHandler())

    //Log the request
    new Middlewares\AccessLog($app->get('logger')),

    //Calculate the response time
    new Middlewares\ResponseTime(),

    //Removes the trailing slash
    new Middlewares\TrailingSlash(false),

    //Insert the UUID
    new Middlewares\Uuid(),

    //Disable the search engine robots
    new Middlewares\Robots(false),

    //Compress the response to gzip
    new Middlewares\GzipEncoder(),

    //Minify the html
    new Middlewares\HtmlMinifier(),

    //Override the method using X-Http-Method-Override header
    new Middlewares\MethodOverride(),

    //Parse the json payload
    new Middlewares\JsonPayload(),

    //Parse the urlencoded payload
    new Middlewares\UrlEncodePayload(),

    //Save the client ip in the '_ip' attribute
    (new Middlewares\ClientIp())

    //Allow only some ips
    (new Middlewares\Firewall(['127.0.0.*']))

    //Add cache expiration headers
    new Middlewares\Expires(),

    //Negotiate the content-type
    new Middlewares\ContentType(),

    //Negotiate the language
    new Middlewares\ContentLanguage(['gl', 'es', 'en']),

    //Handle the routes with fast-route
    new Middlewares\FastRoute($app->get('dispatcher')),

    //Create and save a session in '_session' attribute
    (new Middlewares\AuraSession())

    //Add the php debugbar
    new Middlewares\Debugbar(),

    //Handle the route
    new Middlewares\RequestHandler(),

$response = $dispatcher->dispatch(ServerRequestFactory::fromGlobals());

List of all available middlewares


Client info

Develop utils








Use the package repository of each component to notify any issue or pull request related with it, and use this repository for generical questions, new middlewares discussions, etc.

If you want to contribute with new middlewares, you can take a look to these ideas. There's also a skeleton that you can use for quick start.

See CONTRIBUTING for contributing details.


Download the logo from the art directory.

The MIT License (MIT). Please see LICENSE for more information.