ToolbarPanel
API reference › Debug Core › Toolbar › ToolbarPanel
Represents a navigable group of metrics in the debug toolbar.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$extension readonly constructor | bool | true when the panel is provider-owned or optional and the toolbar groups it under its Extensions menu; false when the panel is built in and stays inline. Default: false. | ToolbarPanel |
$icon readonly constructor | string| | Shared icon name or null when no icon is available. Default: null. | ToolbarPanel |
$id readonly constructor | string | Stable panel identifier. | ToolbarPanel |
$items readonly constructor | list<ToolbarItem> | Panel metrics. Default: []. | ToolbarPanel |
$title readonly constructor | string | Display title. | ToolbarPanel |
$url readonly constructor | string| | Debug page URL or null when only individual metrics are navigable. Default: null. | ToolbarPanel |
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
create() static | Creates a panel with no metrics or optional navigation. | ToolbarPanel |
jsonSerialize() | Returns the panel payload consumed by the toolbar runtime. | ToolbarPanel |
withExtension() | Returns a copy with the specified extension classification. | ToolbarPanel |
withIcon() | Returns a copy with the specified icon. | ToolbarPanel |
withItems() | Returns a copy with the replacement metric list. | ToolbarPanel |
withUrl() | Returns a copy with the specified URL. | ToolbarPanel |
Method details
Section titled “Method details”create()
Section titled “create() ”public static function create(string $id, string $title): selfCreates a panel with no metrics or optional navigation.
Parameters
| Parameter | Type | Description |
|---|---|---|
$id | string | Stable panel identifier. |
$title | string | Display title. |
Returns
self: Panel carrying only its identity.
jsonSerialize()
Section titled “jsonSerialize() ”public function jsonSerialize(): 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}Returns the panel payload consumed by the toolbar runtime.
Returns
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}: Serialized panel payload.
withExtension()
Section titled “withExtension() ”public function withExtension(bool $extension): selfReturns a copy with the specified extension classification.
An extension panel is provider-owned or optional, so the toolbar groups it under its Extensions menu, while built-in panels stay inline.
Parameters
| Parameter | Type | Description |
|---|---|---|
$extension | bool | true to group the panel under the Extensions menu; false to keep it inline. |
Returns
self: Panel with the classification applied.
withIcon()
Section titled “withIcon() ”public function withIcon(string|null $icon): selfReturns a copy with the specified icon.
Parameters
| Parameter | Type | Description |
|---|---|---|
$icon | string| | Shared icon name, or null when no icon is available. |
Returns
self: Panel with the icon applied.
withItems()
Section titled “withItems() ”public function withItems(list<PHPForge\Debug\Toolbar\ToolbarItem> $items): selfReturns a copy with the replacement metric list.
Parameters
| Parameter | Type | Description |
|---|---|---|
$items | list<ToolbarItem> | Panel metrics in display order; [] removes all metrics. |
Returns
self: Panel with the metrics applied.
withUrl()
Section titled “withUrl() ”public function withUrl(string|null $url): selfReturns a copy with the specified URL.
Parameters
| Parameter | Type | Description |
|---|---|---|
$url | string| | Debug page URL, or null when only individual metrics are navigable. |
Returns
self: Panel with the URL applied.