API reference / Quittio \ Laravel \ Support
Settings
final readonly class in quittio/laravel
Quittio\Laravel\Support\Settings · Source
Typed read access to a configuration array ("quittio" by default) with dot notation.
Methods#
| Method | Description |
|---|---|
->__construct() | |
->array() | |
->bool() | The boolean at $key; $default when it is missing or null. Throws a ConfigurationException for another type. |
->get() | The value at $key in dot notation (e.g. "seller.address.city"), or $default when a segment is missing. |
->int() | The integer at $key; $default when it is missing or null. Throws a ConfigurationException for another type. |
->nullableString() | The string at $key; null when it is missing, null or empty. Throws a ConfigurationException for another type. |
->section() | The array at $key as settings of their own, whose error messages name the full key; empty when the key is missing. Throws a ConfigurationException when the value is no array. |
->string() | The string at $key; $default when it is missing, null or empty. Throws a ConfigurationException for another type. |
->strings() |
__construct()#
public function __construct(array<array-key, mixed> $values, string $path = 'quittio')| Parameter | Type | Description |
|---|---|---|
$values | array<array-key, mixed> | |
$path | string = 'quittio' | configuration key of $values, used in error messages |
array()#
public function array(string $key): array<string, mixed>| Parameter | Type | Description |
|---|---|---|
$key | string |
- Returns
array<string, mixed>
bool()#
public function bool(string $key, bool $default): boolThe boolean at $key; $default when it is missing or null. Throws a ConfigurationException for another type.
| Parameter | Type | Description |
|---|---|---|
$key | string | |
$default | bool |
- Returns
bool
get()#
public function get(string $key, mixed $default = null): mixedThe value at $key in dot notation (e.g. "seller.address.city"), or $default when a segment is missing.
| Parameter | Type | Description |
|---|---|---|
$key | string | |
$default | mixed = null |
- Returns
mixed
int()#
public function int(string $key, int $default): intThe integer at $key; $default when it is missing or null. Throws a ConfigurationException for another type.
| Parameter | Type | Description |
|---|---|---|
$key | string | |
$default | int |
- Returns
int
nullableString()#
public function nullableString(string $key): ?stringThe string at $key; null when it is missing, null or empty. Throws a ConfigurationException for another type.
| Parameter | Type | Description |
|---|---|---|
$key | string |
- Returns
?string
section()#
public function section(string $key): selfThe array at $key as settings of their own, whose error messages name the full key; empty when the key is missing. Throws a ConfigurationException when the value is no array.
| Parameter | Type | Description |
|---|---|---|
$key | string |
- Returns
self
string()#
public function string(string $key, string $default): stringThe string at $key; $default when it is missing, null or empty. Throws a ConfigurationException for another type.
| Parameter | Type | Description |
|---|---|---|
$key | string | |
$default | string |
- Returns
string
strings()#
public function strings(string $key): list<string>| Parameter | Type | Description |
|---|---|---|
$key | string |
- Returns
list<string>