Skip to content

RequestHandler: add Example

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

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