# ToolbarData

> Represents the framework-neutral payload loaded by the debug toolbar runtime.

[API reference](/docs/api/index.md) › [Debug Core](/docs/extensions/debug-core/reference/index.md) › [Toolbar](/docs/extensions/debug-core/reference/toolbar/index.md) › ToolbarData

| final readonly class | `PHPForge\Debug\Toolbar\ToolbarData` |
| --- | --- |
| Implements | [`JsonSerializable`](https://www.php.net/manual/en/class.jsonserializable.php) |
| Source | [`src/Toolbar/ToolbarData.php`](https://github.com/php-forge/debug-core/blob/main/src/Toolbar/ToolbarData.php#L14) |

Represents the framework-neutral payload loaded by the debug toolbar runtime.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-configUrl"></span>`$configUrl` readonly constructor | `string` | Framework configuration URL. | `ToolbarData` |
| <span id="property-defaultHeight"></span>`$defaultHeight` readonly constructor | `int` | Initial drawer height percentage. Default: `50`. | `ToolbarData` |
| <span id="property-iconBaseUrl"></span>`$iconBaseUrl` readonly constructor | `string` | Base URL for optional SVG icons. Default: `''`. | `ToolbarData` |
| <span id="property-indexUrl"></span>`$indexUrl` readonly constructor | `string` | Debug history URL. | `ToolbarData` |
| <span id="property-items"></span>`$items` readonly constructor | `list<`[`ToolbarPanel`](/docs/extensions/debug-core/reference/toolbar/toolbarpanel/index.md)`>` | Toolbar panels. | `ToolbarData` |
| <span id="property-logo"></span>`$logo` readonly constructor | `string\|null` | Primary logo URL or `null` to use the fallback. Default: `null`. | `ToolbarData` |
| <span id="property-logoFallback"></span>`$logoFallback` readonly constructor | `string\|null` | Fallback logo URL or `null` to render the built-in mark. Default: `null`. | `ToolbarData` |
| <span id="property-phpInfoUrl"></span>`$phpInfoUrl` readonly constructor | `string\|null` | PHP information URL or `null` when unavailable. Default: `null`. | `ToolbarData` |
| <span id="property-phpVersion"></span>`$phpVersion` readonly constructor | `string\|null` | PHP version label or `null` when omitted. Default: `null`. | `ToolbarData` |
| <span id="property-position"></span>`$position` readonly constructor | `string` | Initial toolbar position. Default: `'bottom'`. | `ToolbarData` |
| <span id="property-tag"></span>`$tag` readonly constructor | `string` | Captured request tag. | `ToolbarData` |
| <span id="property-title"></span>`$title` readonly constructor | `string` | Toolbar brand title. | `ToolbarData` |
| <span id="property-yiiVersion"></span>`$yiiVersion` readonly constructor | `string\|null` | Yii version label or `null` when omitted. Default: `null`. | `ToolbarData` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`create()`](#method-create) static | Creates a minimal toolbar payload ready for immutable enrichment. | `ToolbarData` |
| [`jsonSerialize()`](#method-jsonSerialize) | Returns the complete payload consumed by the toolbar runtime. | `ToolbarData` |
| [`withBranding()`](#method-withBranding) | Returns a copy with brand assets and version labels. | `ToolbarData` |
| [`withNavigation()`](#method-withNavigation) | Returns a copy with debugger navigation URLs. | `ToolbarData` |
| [`withPanels()`](#method-withPanels) | Returns a copy with toolbar panels. | `ToolbarData` |
| [`withPresentation()`](#method-withPresentation) | Returns a copy with drawer presentation settings. | `ToolbarData` |

## Method details

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

```php
public static function create(string $tag, string $title): self
```

Creates a minimal toolbar payload ready for immutable enrichment.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$tag` | `string` |  |
| `$title` | `string` |  |

**Returns**

`self`

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

```php
public function jsonSerialize(): array{configUrl: string, defaultHeight: int, iconBaseUrl: string, indexUrl: string, items: list<array{id: string, title: string, items: list<array{value: string, status: string, label?: string, icon?: string, title?: string, url?: string, id?: string}>, url?: string, icon?: string, extension?: true}>, logo: string|null, logoFallback: string|null, phpInfoUrl: string|null, phpVersion: string|null, position: string, tag: string, title: string, yiiVersion: string|null}
```

Returns the complete payload consumed by the toolbar runtime.

**Returns**

`array{configUrl: string, defaultHeight: int, iconBaseUrl: string, indexUrl: string, items: list<array{id: string, title: string, items: list<array{value: string, status: string, label?: string, icon?: string, title?: string, url?: string, id?: string}>, url?: string, icon?: string, extension?: true}>, logo: string|null, logoFallback: string|null, phpInfoUrl: string|null, phpVersion: string|null, position: string, tag: string, title: string, yiiVersion: string|null}`: Serialized toolbar payload.

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

```php
public function withBranding(string|null $logo, string|null $logoFallback, string|null $phpVersion, string|null $yiiVersion): self
```

Returns a copy with brand assets and version labels.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$logo` | `string\|null` |  |
| `$logoFallback` | `string\|null` |  |
| `$phpVersion` | `string\|null` |  |
| `$yiiVersion` | `string\|null` |  |

**Returns**

`self`

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

```php
public function withNavigation(string $indexUrl, string $configUrl, string|null $phpInfoUrl): self
```

Returns a copy with debugger navigation URLs.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$indexUrl` | `string` |  |
| `$configUrl` | `string` |  |
| `$phpInfoUrl` | `string\|null` |  |

**Returns**

`self`

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

```php
public function withPanels(list<PHPForge\Debug\Toolbar\ToolbarPanel> $items): self
```

Returns a copy with toolbar panels.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$items` | `list<`[`ToolbarPanel`](/docs/extensions/debug-core/reference/toolbar/toolbarpanel/index.md)`>` |  |

**Returns**

`self`

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

```php
public function withPresentation(string $position, int $defaultHeight, string $iconBaseUrl = ''): self
```

Returns a copy with drawer presentation settings.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$position` | `string` |  |
| `$defaultHeight` | `int` |  |
| `$iconBaseUrl` | `string` |  |

**Returns**

`self`