Skip to content
PHP Ecosystem
Explore

ToolbarOptions

API reference › Yii3 Debug › Middleware › ToolbarOptions

final readonly classYii3\Debug\Middleware\ToolbarOptions
Sourcesrc/Middleware/ToolbarOptions.php

Carries the yii3/debug settings shared by the debugger middlewares, the debugger pages, and the toolbar payload.

One instance built from the application parameters reaches every consumer through the container, so the route prefix and the toolbar presentation cannot drift apart between the services that read them.

PropertyTypeDescriptionDefined by
$excessiveCallerThreshold readonly constructorint|nullStatements per call site that flag it as excessive, or null to disable the check. Default: null.ToolbarOptions
$height readonly constructorintCollapsed toolbar height, in pixels. Default: 50.ToolbarOptions
$historySize readonly constructorintCaptures kept before the oldest are rotated out. Default: 50.ToolbarOptions
$position readonly constructorstringEdge the toolbar docks to. Default: 'bottom'.ToolbarOptions
$routePrefix readonlystringBase path the debugger endpoints are served under, without a trailing slash.ToolbarOptions
$skipUrls readonly constructorlist<string>Same-origin URLs excluded from AJAX tracking. Default: [].ToolbarOptions
MethodDescriptionDefined by
__construct()Normalizes the shared route, retention, AJAX, and toolbar presentation settings.ToolbarOptions
fromParams() staticCreates the options from the yii3/debug parameter block.ToolbarOptions
isDebugPath()Returns whether a request path targets the debugger itself.ToolbarOptions
public function __construct(string $routePrefix = '/debug', int $historySize = 50, int|null $excessiveCallerThreshold = null, list<string> $skipUrls = [], string $position = 'bottom', int $height = 50)

Normalizes the shared route, retention, AJAX, and toolbar presentation settings.

Parameters

ParameterTypeDescription
$routePrefixstringBase path the debugger endpoints are served under; a trailing slash is trimmed.
$historySizeintCaptures kept before the oldest are rotated out.
$excessiveCallerThresholdint|nullStatements per call site that flag it as excessive, or null to disable the check.
$skipUrlslist<string>Same-origin URLs excluded from AJAX tracking.
$positionstringEdge the toolbar docks to.
$heightintCollapsed toolbar height, in pixels.
public static function fromParams(array<array-key, mixed> $params): self

Creates the options from the yii3/debug parameter block.

A key the block omits keeps its default; a key it declares must hold a value of the expected type, because the parameters are merged from several packages and a wrong type would otherwise surface far from its source.

Parameters

ParameterTypeDescription
$paramsarray<array-key, mixed>The yii3/debug parameter block.

Returns

self: Options carrying the declared values.

Throws

public function isDebugPath(string $path): bool

Returns whether a request path targets the debugger itself.

The prefix must match a whole path segment, so /debugger stays an application path under the /debug prefix.

Parameters

ParameterTypeDescription
$pathstringRequest path, without the query string.

Returns

bool: true when the path is the prefix or lies under it; false otherwise.