ContextComponentInterface
A core component the Context constructs from the factory metadata captured at Context::initialize() and drives through a two-step lifecycle.
The request, user, routing and database manager are all built this way, and all four are rebuilt on demand after the worker request boundary nulls them. This interface is what lets Context express that rebuild once instead of per component.
Return types are deliberately left undeclared: implementations are free to declare void (or anything else), which keeps application subclasses of the shipped components compatible whether or not they declare one.
Synopsis
Section titled “Synopsis”interface ContextComponentInterface
| Implemented by | DatabaseManager, WebRequest, Routing, User |
| Since | 3.2.0 |
| Source | ContextComponentInterface.php |
Methods
Section titled “Methods”| Method | Description |
|---|---|
initialize(Context $context, array<string, mixed> $parameters = []): mixed | Configure this component against the context that owns it. |
startup(): mixed | Begin this component’s active life, after ContextComponentInterface::initialize() has configured it. |
initialize()
Section titled “initialize()”abstract public function initialize(Context $context, array<string, mixed> $parameters = []): mixed
Configure this component against the context that owns it.
| Parameter | Type | Description |
|---|---|---|
$context | Context | |
$parameters | array``<``string``, ``mixed``> |
Returns mixed — Ignored; declared untyped so implementations may narrow it.
startup()
Section titled “startup()”abstract public function startup(): mixed
Begin this component’s active life, after ContextComponentInterface::initialize() has configured it.
Returns mixed — Ignored; declared untyped so implementations may narrow it.