# ToolbarOptions

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

[API reference](/docs/api/index.md) › [Yii3 Debug](/docs/extensions/yii3-debug/reference/index.md) › [Middleware](/docs/extensions/yii3-debug/reference/middleware/index.md) › ToolbarOptions

| final readonly class | `Yii3\Debug\Middleware\ToolbarOptions` |
| --- | --- |
| Source | [`src/Middleware/ToolbarOptions.php`](https://github.com/yii3/debug/blob/main/src/Middleware/ToolbarOptions.php#L24) |

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.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-excessiveCallerThreshold"></span>`$excessiveCallerThreshold` readonly constructor | `int\|null` | Statements per call site that flag it as excessive, or `null` to disable the check. Default: `null`. | `ToolbarOptions` |
| <span id="property-height"></span>`$height` readonly constructor | `int` | Collapsed toolbar height, in pixels. Default: `50`. | `ToolbarOptions` |
| <span id="property-historySize"></span>`$historySize` readonly constructor | `int` | Captures kept before the oldest are rotated out. Default: `50`. | `ToolbarOptions` |
| <span id="property-position"></span>`$position` readonly constructor | `string` | Edge the toolbar docks to. Default: `'bottom'`. | `ToolbarOptions` |
| <span id="property-routePrefix"></span>`$routePrefix` readonly | `string` | Base path the debugger endpoints are served under, without a trailing slash. | `ToolbarOptions` |
| <span id="property-skipUrls"></span>`$skipUrls` readonly constructor | `list<string>` | Same-origin URLs excluded from AJAX tracking. Default: `[]`. | `ToolbarOptions` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Normalizes the shared route, retention, AJAX, and toolbar presentation settings. | `ToolbarOptions` |
| [`fromParams()`](#method-fromParams) static | Creates the options from the `yii3/debug` parameter block. | `ToolbarOptions` |
| [`isDebugPath()`](#method-isDebugPath) | Returns whether a request path targets the debugger itself. | `ToolbarOptions` |

## Method details

### __construct() <span id="method-__construct"></span>

```php
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**

| Parameter | Type | Description |
| --- | --- | --- |
| `$routePrefix` | `string` | Base path the debugger endpoints are served under; a trailing slash is trimmed. |
| `$historySize` | `int` | Captures kept before the oldest are rotated out. |
| `$excessiveCallerThreshold` | `int\|null` | Statements per call site that flag it as excessive, or `null` to disable the check. |
| `$skipUrls` | `list<string>` | Same-origin URLs excluded from AJAX tracking. |
| `$position` | `string` | Edge the toolbar docks to. |
| `$height` | `int` | Collapsed toolbar height, in pixels. |

### fromParams() <span id="method-fromParams"></span>

```php
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**

| Parameter | Type | Description |
| --- | --- | --- |
| `$params` | `array<array-key, mixed>` | The `yii3/debug` parameter block. |

**Returns**

`self`: Options carrying the declared values.

**Throws**

- [`InvalidArgumentException`](https://www.php.net/manual/en/class.invalidargumentexception.php): when a declared key holds a value of the wrong type.

### isDebugPath() <span id="method-isDebugPath"></span>

```php
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**

| Parameter | Type | Description |
| --- | --- | --- |
| `$path` | `string` | Request path, without the query string. |

**Returns**

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