DebugRequestHandler
API reference › Yii3 Debug › Web › DebugRequestHandler
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.
Methods
Section titled “Methods”| Method | Description | Defined 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 |
Method details
Section titled “Method details”__construct()
Section titled “__construct() ”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
| Parameter | Type | Description |
|---|---|---|
$container | Psr\ | Container the endpoint is resolved from when the path matches. |
$responseFactory | Psr\ | Factory building the rejection responses. |
$options | Yii3\ | Settings carrying the route prefix the debugger endpoints are served under. |
forbidden()
Section titled “forbidden() ”public function forbidden(): Psr\Http\Message\ResponseInterfaceRejects a client that may not reach the debugger.
Returns
Psr\Http\Message\ResponseInterface: Empty 403 Forbidden response, marked Cache-Control: no-store.
handle()
Section titled “handle() ”public function handle(Psr\Http\Message\ServerRequestInterface $request): Psr\Http\Message\ResponseInterfaceServes 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
| Parameter | Type | Description |
|---|---|---|
$request | Psr\ | Request 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
RuntimeException: when the container resolves the endpoint to something else.