Env
Runtime and configuration value injection.
Purpose & processing
Reads the environment value from $_ENV first, then getenv().
Parameters
| Parameter | Type | Default | Behavior |
|---|---|---|---|
| key | string | Required | Key used to resolve the value. |
Example
#[Env('APP_ENV')]
protected string|null $environment = null;
Behavior and considerations
- A non-null $_ENV entry takes precedence.
- If getenv() returns false or neither source contains a value, null is injected.
- Values are not automatically coerced to another type.
Source
shared/src/Core/Annotation/Env.php