Skip to content
PHP Ecosystem
Explore

ToolbarPanel

API reference › Debug Core › Toolbar › ToolbarPanel

final readonly classPHPForge\Debug\Toolbar\ToolbarPanel
ImplementsJsonSerializable
Sourcesrc/Toolbar/ToolbarPanel.php

Represents a navigable group of metrics in the debug toolbar.

PropertyTypeDescriptionDefined by
$extension readonly constructorbooltrue 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 constructorstring|nullShared icon name or null when no icon is available. Default: null.ToolbarPanel
$id readonly constructorstringStable panel identifier.ToolbarPanel
$items readonly constructorlist<ToolbarItem>Panel metrics. Default: [].ToolbarPanel
$title readonly constructorstringDisplay title.ToolbarPanel
$url readonly constructorstring|nullDebug page URL or null when only individual metrics are navigable. Default: null.ToolbarPanel
MethodDescriptionDefined by
create() staticCreates 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
public static function create(string $id, string $title): self

Creates a panel with no metrics or optional navigation.

Parameters

ParameterTypeDescription
$idstringStable panel identifier.
$titlestringDisplay title.

Returns

self: Panel carrying only its identity.

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.

public function withExtension(bool $extension): self

Returns 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

ParameterTypeDescription
$extensionbooltrue to group the panel under the Extensions menu; false to keep it inline.

Returns

self: Panel with the classification applied.

public function withIcon(string|null $icon): self

Returns a copy with the specified icon.

Parameters

ParameterTypeDescription
$iconstring|nullShared icon name, or null when no icon is available.

Returns

self: Panel with the icon applied.

public function withItems(list<PHPForge\Debug\Toolbar\ToolbarItem> $items): self

Returns a copy with the replacement metric list.

Parameters

ParameterTypeDescription
$itemslist<ToolbarItem>Panel metrics in display order; [] removes all metrics.

Returns

self: Panel with the metrics applied.

public function withUrl(string|null $url): self

Returns a copy with the specified URL.

Parameters

ParameterTypeDescription
$urlstring|nullDebug page URL, or null when only individual metrics are navigable.

Returns

self: Panel with the URL applied.