middlewares/psr15-middlewares

Name: psr15-middlewares

Owner: Middlewares

Description: Collection of PSR-15 middlewares

Created: 2016-10-10 16:36:47.0

Updated: 2018-05-24 04:55:02.0

Pushed: 2018-04-04 16:45:34.0

Homepage: null

Size: 47

Language: null

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

logo

psr15-middlewares

Collection of PSR-15 middlewares

Requirements
Usage example
Zend\Diactoros\ServerRequestFactory;
Middlewares\Utils\Dispatcher;
Middlewares;

patcher = new Dispatcher([

//Handle errors
(new Middlewares\ErrorHandler())
    ->catchExceptions(true),

//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())
    ->attribute('_ip'),

//Allow only some ips
(new Middlewares\Firewall(['127.0.0.*']))
    ->ipAttribute('_ip'),

//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())
    ->attribute('_session'),

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

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


ponse = $dispatcher->dispatch(ServerRequestFactory::fromGlobals());
List of all available components
Authentication
Client info
Develop utils
Optimization
Routers
Security
Session
Urls
Others
Contributing

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.

Logo

Download the logo from the art directory.


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


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.