Skip to content

RequestHandler: add Example

Terry L edited this page Jun 21, 2020 · 3 revisions

Shieldon\Psr15\RequestHandler

add($middleware)

  • param MiddlewareInterface middleware * The middleware.
  • return void

Example:

$finalHandler = new FinalHandler();

$app = new RequestHandler($finalHandler);
$app->add(new ApiMiddleware());
$app->add(new StringMiddleware());

$response = $app->handle(ServerRequestFactory::fromGlobal());
Clone this wiki locally