- Notifications
You must be signed in to change notification settings - Fork14
Collection of PSR-15 middlewares officially developed by Middlewares organization
License
middlewares/psr15-middlewares
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Collection ofPSR-15 middlewares
- PHP >=7.2
- APSR-7 http message implementation (Diactoros,Slim,or many more here)
- APSR-15 middleware dispatcher
useLaminas\Diactoros\ServerRequestFactory;useMiddlewares\Utils\Dispatcher;useMiddlewares;$dispatcher =newDispatcher([//Handle errors (newMiddlewares\ErrorHandler()) ->catchExceptions(true),//Log the requestnewMiddlewares\AccessLog($app->get('logger')),//Calculate the response timenewMiddlewares\ResponseTime(),//Removes the trailing slashnewMiddlewares\TrailingSlash(false),//Insert the UUIDnewMiddlewares\Uuid(),//Disable the search engine robotsnewMiddlewares\Robots(false),//Compress the response to gzipnewMiddlewares\GzipEncoder(),//Minify the htmlnewMiddlewares\HtmlMinifier(),//Override the method using X-Http-Method-Override headernewMiddlewares\MethodOverride(),//Parse the json payloadnewMiddlewares\JsonPayload(),//Parse the urlencoded payloadnewMiddlewares\UrlEncodePayload(),//Save the client ip in the '_ip' attribute (newMiddlewares\ClientIp()) ->attribute('_ip'),//Allow only some ips (newMiddlewares\Firewall(['127.0.0.*'])) ->ipAttribute('_ip'),//Add cache expiration headersnewMiddlewares\Expires(),//Add the php debugbarnewMiddlewares\Debugbar(),//Negotiate the content-typenewMiddlewares\ContentType(),//Negotiate the languagenewMiddlewares\ContentLanguage(['gl','es','en']),//Handle the routes with fast-routenewMiddlewares\FastRoute($app->get('dispatcher')),//Create and save a session in '_session' attribute (newMiddlewares\AuraSession()) ->attribute('_session'),//Handle the routenewMiddlewares\RequestHandler(),]);$response =$dispatcher->dispatch(ServerRequestFactory::fromGlobals());
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 tothese ideas. There's also askeleton that you can use for quick start.
SeeCONTRIBUTING for contributing details.
Download the logo fromthe art directory.
The MIT License (MIT). Please seeLICENSE for more information.
About
Collection of PSR-15 middlewares officially developed by Middlewares organization
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors6
Uh oh!
There was an error while loading.Please reload this page.