Skip to content
PHP Ecosystem
Explore

ToolbarDataFactory

API reference › Yii3 Debug › ToolbarDataFactory

final classYii3\Debug\ToolbarDataFactory
Sourcesrc/ToolbarDataFactory.php

Creates toolbar data from framework metadata and captured extension panels.

MethodDescriptionDefined by
__construct()Creates a toolbar-data factory with asset URL and debugger route configuration.ToolbarDataFactory
create()Builds the toolbar chrome for a capture, without its panels.ToolbarDataFactory
createForSnapshot()Builds the complete toolbar payload for a capture, panels included.ToolbarDataFactory
withExtensionPanels()Returns a copy carrying the extension panels shown on the toolbar.ToolbarDataFactory
public function __construct(Yiisoft\Assets\AssetManager $assetManager, Yii3\Debug\Middleware\ToolbarOptions $options = new \Yii3\Debug\Middleware\ToolbarOptions())

Creates a toolbar-data factory with asset URL and debugger route configuration.

Parameters

ParameterTypeDescription
$assetManagerYiisoft\Assets\AssetManagerManager resolving the published URLs of the toolbar assets.
$optionsYii3\Debug\Middleware\ToolbarOptionsSettings carrying the route prefix every debugger URL is built on and the toolbar presentation.
public function create(string $tag): PHPForge\Debug\Toolbar\ToolbarData

Builds the toolbar chrome for a capture, without its panels.

Parameters

ParameterTypeDescription
$tagstringTag of the capture the toolbar links to.

Returns

ToolbarData: Toolbar payload carrying navigation, presentation, and branding.

public function createForSnapshot(PHPForge\Debug\Storage\DebugSnapshot $snapshot): PHPForge\Debug\Toolbar\ToolbarData

Builds the complete toolbar payload for a capture, panels included.

Parameters

ParameterTypeDescription
$snapshotPHPForge\Debug\Storage\DebugSnapshotCapture the toolbar describes.

Returns

ToolbarData: Toolbar payload including every registered extension panel.

public function withExtensionPanels(iterable<Yii3\Debug\Panel\ExtensionPanelInterface> $extensionPanels): self

Returns a copy carrying the extension panels shown on the toolbar.

Chips follow the order given, which is the order the sidebar lists the same panels in: the container passes ExtensionRegistry::panelsWithBuiltIns(), built-ins first in BuiltInPanels::IDS order.

Parameters

ParameterTypeDescription
$extensionPanelsiterable<Yii3\Debug\Panel\ExtensionPanelInterface>Optional extension presenters in toolbar order.

Returns

self: Factory with the panels applied.

Throws