Server
Runtime and configuration value injection.
Purpose & processing
Reads the named entry from the PHP $_SERVER array.
Parameters
| Parameter | Type | Default | Behavior |
|---|---|---|---|
| key | string | Required | Key used to resolve the value. |
Example
#[Server('HTTP_HOST')]
protected string|null $host = null;
Behavior and considerations
- A missing key raises AnnotationException::serverKeyNotFound().
- An existing key with a null value is accepted.
- HTTP-specific server keys may be absent in cmd and worker contexts.
Source
shared/src/Core/Annotation/Server.php