Skip to content
PHP Ecosystem
Explore

ProviderPanel

API reference › Yii3 Debug › Panel › ProviderPanel

classYii3\Debug\Panel\ProviderPanel
ImplementsToolbarPanelProviderInterface
Sourcesrc/Panel/ProviderPanel.php
3 subclasses

Adapts any provider-owned declarative panel to the Yii3 debugger.

The presentation is built on first use and memoized for the payload it was built from, so the listing check, the toolbar metrics, and the detail page of one capture share a single provider call.

MethodDescriptionDefined by
__construct()Creates an adapter for a provider-owned declarative panel.ProviderPanel
hasContent()Returns whether the capture holds a presentation for this panel.ProviderPanel
icon()Returns the shared Debug Core icon key.ProviderPanel
id()Returns the stable identifier of this panel.ProviderPanel
name()Returns the human-readable panel name.ProviderPanel
render()Renders the detail content the provider produces for a capture.ProviderPanel
toolbarItems()Builds the toolbar metrics the provider declares for a capture.ProviderPanel
withMetadata()Returns a copy presenting the panel under the metadata the application configured.ProviderPanel
public function __construct(PHPForge\Debug\Panel $provider)

Creates an adapter for a provider-owned declarative panel.

Parameters

ParameterTypeDescription
$providerPHPForge\Debug\PanelDeclarative panel supplying the identity and presentation.
public function hasContent(array<string, mixed> $payload): bool

Returns whether the capture holds a presentation for this panel.

An extension the application enabled stays listed even on a capture where it recorded no activity, so its own empty state explains the idle capture instead of the entry disappearing from the sidebar. Building the presentation here keeps a failing provider discoverable, because the failure reaches the host, and it primes the memo the toolbar and the detail page read next.

Parameters

ParameterTypeDescription
$payloadarray<string, mixed>Serialized panel payload.

Returns

bool: true, since the host only asks once the capture carries this panel’s payload.

Throws

  • Throwable: if the provider cannot present the payload.
public function icon(): string

Returns the shared Debug Core icon key.

Returns

string: Effective icon key, falling back to the provider default.

public function id(): string

Returns the stable identifier of this panel.

Returns

string: Stable panel ID declared by the provider.

public function name(): string

Returns the human-readable panel name.

Returns

string: Effective display name, falling back to the provider default.

public function render(Yii3\Debug\Panel\PanelRenderInput $input): string

Renders the detail content the provider produces for a capture.

Only the payload reaches the provider, so the portable presentation stays independent of the host request.

Parameters

ParameterTypeDescription
$inputPanelRenderInputPayload, request context, and request summary of the page being rendered.

Returns

string: Rendered detail content.

Throws

  • Throwable: if the provider cannot present the payload.
public function toolbarItems(array<string, mixed> $payload): list<PHPForge\Debug\Toolbar\ToolbarItem>

Builds the toolbar metrics the provider declares for a capture.

Parameters

ParameterTypeDescription
$payloadarray<string, mixed>Serialized panel payload.

Returns

list<PHPForge\Debug\Toolbar\ToolbarItem>: Toolbar metrics declared by the provider.

Throws

  • Throwable: if the provider cannot present the payload.
public function withMetadata(string $title, string $icon): self

Returns a copy presenting the panel under the metadata the application configured.

The detail heading, the sidebar entry, and the toolbar chip all read the effective title, so the panel keeps one name across the debugger while ProviderPanel::id() stays the stable capture key.

Parameters

ParameterTypeDescription
$titlestringEffective display title.
$iconstringEffective icon key.

Returns

self: Adapter presenting the configured metadata, with an empty memo.