Zum Inhalt springen

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#

MethodDescription
->__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')
ParameterTypeDescription
$valuesarray<array-key, mixed>
$pathstring = 'quittio'configuration key of $values, used in error messages

array()#

public function array(string $key): array<string, mixed>
ParameterTypeDescription
$keystring
Returns
array<string, mixed>

bool()#

public function bool(string $key, bool $default): bool

The boolean at $key; $default when it is missing or null. Throws a ConfigurationException for another type.

ParameterTypeDescription
$keystring
$defaultbool
Returns
bool

get()#

public function get(string $key, mixed $default = null): mixed

The value at $key in dot notation (e.g. "seller.address.city"), or $default when a segment is missing.

ParameterTypeDescription
$keystring
$defaultmixed = null
Returns
mixed

int()#

public function int(string $key, int $default): int

The integer at $key; $default when it is missing or null. Throws a ConfigurationException for another type.

ParameterTypeDescription
$keystring
$defaultint
Returns
int

nullableString()#

public function nullableString(string $key): ?string

The string at $key; null when it is missing, null or empty. Throws a ConfigurationException for another type.

ParameterTypeDescription
$keystring
Returns
?string

section()#

public function section(string $key): self

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.

ParameterTypeDescription
$keystring
Returns
self

string()#

public function string(string $key, string $default): string

The string at $key; $default when it is missing, null or empty. Throws a ConfigurationException for another type.

ParameterTypeDescription
$keystring
$defaultstring
Returns
string

strings()#

public function strings(string $key): list<string>
ParameterTypeDescription
$keystring
Returns
list<string>

Die Open-Core-Pakete stehen unter der MIT-Lizenz. Die rechtlichen Formulierungen der Länderpakete sind mit einer Steuerberatung abzustimmen.