You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 to these ideas. There's also a skeleton that you can use for quick start.