Skip to content
PHP Ecosystem
Explore

DebugRequestHandler

API reference › Yii3 Debug › Web › DebugRequestHandler

final classYii3\Debug\Web\DebugRequestHandler
Sourcesrc/Web/DebugRequestHandler.php

Serves the debugger endpoints from the toolbar middleware, without a route declaration.

Endpoints are resolved lazily from the container, so a request the debugger does not own costs no action instantiation.

MethodDescriptionDefined by
__construct()Creates the debugger endpoint handler resolved through the container.DebugRequestHandler
forbidden()Rejects a client that may not reach the debugger.DebugRequestHandler
handle()Serves the endpoint the path selects.DebugRequestHandler
public function __construct(Psr\Container\ContainerInterface $container, Psr\Http\Message\ResponseFactoryInterface $responseFactory, Yii3\Debug\Middleware\ToolbarOptions $options = new \Yii3\Debug\Middleware\ToolbarOptions())

Creates the debugger endpoint handler resolved through the container.

Parameters

ParameterTypeDescription
$containerPsr\Container\ContainerInterfaceContainer the endpoint is resolved from when the path matches.
$responseFactoryPsr\Http\Message\ResponseFactoryInterfaceFactory building the rejection responses.
$optionsYii3\Debug\Middleware\ToolbarOptionsSettings carrying the route prefix the debugger endpoints are served under.
public function forbidden(): Psr\Http\Message\ResponseInterface

Rejects a client that may not reach the debugger.

Returns

Psr\Http\Message\ResponseInterface: Empty 403 Forbidden response, marked Cache-Control: no-store.

public function handle(Psr\Http\Message\ServerRequestInterface $request): Psr\Http\Message\ResponseInterface

Serves the endpoint the path selects.

Every response carries Cache-Control: no-store, so captured request data never reaches a shared cache or the browser history.

Parameters

ParameterTypeDescription
$requestPsr\Http\Message\ServerRequestInterfaceRequest targeting the debugger.

Returns

Psr\Http\Message\ResponseInterface: Endpoint response, an empty 404 Not Found for an unknown path, or an empty 405 Method Not Allowed for a write method.

Throws