{{sensio_labs_insight}}
{{description}}.
composer require {{package}}
use {{namespace}}\{{class_name}};
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
// {{create_description}}
$middleware = new {{class_name}}();
// create a dispatcher
$finalHandler = function (ServerRequestInterface $request):ResponseInterface {
return new \Zend\Diactoros\Response();
};
$dispatcher = new \Cormy\Server\MiddlewareDispatcher($middleware, $finalHandler);
// dispatch a request
$response = $dispatcher(new \Zend\Diactoros\ServerRequest());
/**
* {{create_description}}.
*/
public function __construct()
{
}
Inherited from Cormy\Server\MiddlewareInterface::__invoke
/**
* Process an incoming server request and return the response, optionally delegating
* to the next request handler.
*
* @param ServerRequestInterface $request
*
* @return Generator yields PSR `ServerRequestInterface` instances and returns a PSR `ResponseInterface` instance
*/
public function __invoke(ServerRequestInterface $request):Generator;
- Cormy\Server\Onion – Onion style PSR-7 middleware stack using generators
- Cormy\Server\Bamboo – Bamboo style PSR-7 middleware pipe using generators
- Cormy\Server\RequestHandlerInterface – Common interfaces for PSR-7 server request handlers
- Cormy\Server\MiddlewareInterface – Common interfaces for Cormy PSR-7 server middlewares
- PSR-7: HTTP message interfaces
MIT © {{user_link}}