/** * save session and responder as $request's attribute. * * @param ServerRequestInterface $request * @param ResponseInterface $response * @param callable $next * @return mixed */ public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next) { $request = Respond::withResponder($request, $this->responder); return $next($request, $response); }