Skip to content
PHP Ecosystem
Explore

ExtensionRegistry

API reference › Yii3 Debug › ExtensionRegistry

final readonly classYii3\Debug\ExtensionRegistry
Sourcesrc/ExtensionRegistry.php

Holds the collectors and panels an application registered, ordered by the shared registration policy.

Panels reach ExtensionRegistry::panels() in the order PanelRegistry computes: built-in IDs keep their registration order and every extension follows by position, then by effective title, then by ID.

MethodDescriptionDefined by
__construct()Validates the registration keys, applies the configured metadata, and computes the navigation order.ExtensionRegistry
collectors()Returns the collectors the application enabled.ExtensionRegistry
collectorsWithBuiltIn()Returns the built-in collector first, unless the application explicitly registered an override with the same ID.ExtensionRegistry
collectorsWithBuiltIns()Returns built-in collectors first, replacing each one with an explicitly registered collector of the same ID.ExtensionRegistry
create() staticCreates a registry from explicitly enabled collectors and panels.ExtensionRegistry
disabled()Returns the IDs the configuration removed, which a host tells apart from an ID it never knew.ExtensionRegistry
fromParams() staticCreates a registry from the collectors and panels entries of the application configuration.ExtensionRegistry
panels()Returns the panels the application enabled.ExtensionRegistry
panelsWithBuiltIn()Returns the built-in panel first, unless the application explicitly registered an override with the same ID.ExtensionRegistry
panelsWithBuiltIns()Returns built-in panels first, replacing each one with an explicitly registered panel of the same ID.ExtensionRegistry
withCollector()Returns a copy with one more enabled collector appended.ExtensionRegistry
withPanel()Returns a copy with one more enabled panel appended.ExtensionRegistry
public function __construct(iterable<array-key, PHPForge\Debug\CollectorInterface> $collectors = [], iterable<array-key, Yii3\Debug\Panel\ExtensionPanelInterface|PHPForge\Debug\Panel> $panels = [], iterable<string, PHPForge\Debug\Registration\PanelOverride> $overrides = [], iterable<string> $disabled = [])

Validates the registration keys, applies the configured metadata, and computes the navigation order.

Parameters

ParameterTypeDescription
$collectorsiterable<array-key, CollectorInterface>Enabled collectors in capture order.
$panelsiterable<array-key, Yii3\Debug\Panel\ExtensionPanelInterface|PHPForge\Debug\Panel>Enabled panels, in registration order.
$overridesiterable<string, PHPForge\Debug\Registration\PanelOverride>Application overrides indexed by panel ID.
$disablediterable<string>IDs the configuration disabled, so the host tells them from missing ones.

Throws

  • InvalidArgumentException: when an ID is empty or duplicated, a string key does not match the ID the entry declares, or an override renames a panel rendering its own title and icon.
public function collectors(): list<PHPForge\Debug\CollectorInterface>

Returns the collectors the application enabled.

Returns

list<CollectorInterface>: Enabled collectors in capture order.

public function collectorsWithBuiltIn(PHPForge\Debug\CollectorInterface $builtIn): list<PHPForge\Debug\CollectorInterface>

Returns the built-in collector first, unless the application explicitly registered an override with the same ID.

A built-in whose ID the configuration disabled is dropped instead of placed first.

Parameters

ParameterTypeDescription
$builtInCollectorInterfaceBuilt-in collector to place first.

Returns

list<CollectorInterface>: Built-in and enabled collectors in capture order.

public function collectorsWithBuiltIns(iterable<PHPForge\Debug\CollectorInterface> $builtIns): list<PHPForge\Debug\CollectorInterface>

Returns built-in collectors first, replacing each one with an explicitly registered collector of the same ID.

A built-in whose ID the configuration disabled is dropped instead of placed first.

Parameters

ParameterTypeDescription
$builtInsiterable<CollectorInterface>Built-in collectors in capture order.

Returns

list<CollectorInterface>: Built-in and enabled collectors in capture order.

public static function create(iterable<array-key, PHPForge\Debug\CollectorInterface> $collectors = [], iterable<array-key, Yii3\Debug\Panel\ExtensionPanelInterface|PHPForge\Debug\Panel> $panels = [], iterable<string, PHPForge\Debug\Registration\PanelOverride> $overrides = [], iterable<string> $disabled = []): self

Creates a registry from explicitly enabled collectors and panels.

Parameters

ParameterTypeDescription
$collectorsiterable<array-key, CollectorInterface>Enabled collectors in capture order.
$panelsiterable<array-key, Yii3\Debug\Panel\ExtensionPanelInterface|PHPForge\Debug\Panel>Enabled panels, in registration order.
$overridesiterable<string, PHPForge\Debug\Registration\PanelOverride>Application overrides indexed by panel ID.
$disablediterable<string>IDs the configuration disabled.

Returns

self: Registry holding the enabled collectors and panels.

Throws

public function disabled(): list<string>

Returns the IDs the configuration removed, which a host tells apart from an ID it never knew.

Returns

list<string>: Disabled IDs, sorted alphabetically.

public static function fromParams(iterable<array-key, mixed> $collectors, iterable<array-key, mixed> $panels, Psr\Container\ContainerInterface $container): self

Creates a registry from the collectors and panels entries of the application configuration.

Every entry is a class string, or an array declaring a class string plus options. A collector accepts the enabled option alone; a panel accepts the keys PanelOverride::KEYS. An entry the configuration disabled is reported by ExtensionRegistry::disabled() and its class is never resolved.

Parameters

ParameterTypeDescription
$collectorsiterable<array-key, mixed>Collector entries indexed by configuration ID.
$panelsiterable<array-key, mixed>Panel entries indexed by configuration ID.
$containerPsr\Container\ContainerInterfaceContainer the enabled classes are resolved from.

Returns

self: Registry holding the enabled collectors and panels.

Throws

public function panels(): list<Yii3\Debug\Panel\ExtensionPanelInterface>

Returns the panels the application enabled.

Returns

list<Yii3\Debug\Panel\ExtensionPanelInterface>: Enabled panels in navigation order.

public function panelsWithBuiltIn(Yii3\Debug\Panel\ExtensionPanelInterface $builtIn): list<Yii3\Debug\Panel\ExtensionPanelInterface>

Returns the built-in panel first, unless the application explicitly registered an override with the same ID.

A built-in whose ID the configuration disabled is dropped instead of placed first.

Parameters

ParameterTypeDescription
$builtInYii3\Debug\Panel\ExtensionPanelInterfaceBuilt-in panel to place first.

Returns

list<Yii3\Debug\Panel\ExtensionPanelInterface>: Built-in and enabled panels in navigation order.

public function panelsWithBuiltIns(iterable<Yii3\Debug\Panel\ExtensionPanelInterface> $builtIns): list<Yii3\Debug\Panel\ExtensionPanelInterface>

Returns built-in panels first, replacing each one with an explicitly registered panel of the same ID.

A built-in whose ID the configuration disabled is dropped instead of placed first.

Parameters

ParameterTypeDescription
$builtInsiterable<Yii3\Debug\Panel\ExtensionPanelInterface>Built-in panels in navigation order.

Returns

list<Yii3\Debug\Panel\ExtensionPanelInterface>: Built-in and enabled panels in navigation order.

public function withCollector(PHPForge\Debug\CollectorInterface $collector): self

Returns a copy with one more enabled collector appended.

Parameters

ParameterTypeDescription
$collectorCollectorInterfaceCollector to enable.

Returns

self: Registry including the collector.

Throws

public function withPanel(Yii3\Debug\Panel\ExtensionPanelInterface|PHPForge\Debug\Panel $panel): self

Returns a copy with one more enabled panel appended.

Parameters

ParameterTypeDescription
$panelYii3\Debug\Panel\ExtensionPanelInterface|PHPForge\Debug\PanelPanel to enable; a portable panel is adapted.

Returns

self: Registry including the panel.

Throws