Documentation

Configuration
in package

Configuration contains an array of data parsed from a configuration file (or multiple, in the event of the configuration referring to a directory that contains configuration files).

Due to the fact that configuration is cached, the system generates configuration by invoking a static method that will recursively walk over all the files and import the data, assembling a tree of arrays.

When caching the configuration, the loaded environments are also cached and therefore your application's cache will need to be rebuilt in order to load new environments.

Configuration files are automatically flattened, so that information can be read with dot notation easily.

NOTE: Configuration does not support arrays (this is why they are flattened). I seem to get tripped up by this concept myself a lot, and this is why I'm adding this note. If you need to configure something in an array style fashion you're probably better off using service providers.

Table of Contents

$data  : array<string|int, string>
Contains the configuration array. This array contains the flattened config from the configuration files (even if these contain arrays to set up the stuff)
$interface  : DotNotationAccessor
Using a dot notation accessor for this class removes the complexity from this class and allows us to work on caching the data here.
__construct()  : mixed
export()  : mixed
Retrieve a configuration from the repository. You may not retrieve a config as an array.
get()  : mixed
Retrieve a configuration from the repository. You may not retrieve a config as an array.
import()  : mixed
Import the configuration from a file. These files can contain executable code, or environment calls, but whenever caching is enabled the configuration will be computed once and not be regenerated until you request it.
set()  : Configuration
Set a configuration. Please note that all the code that went before will not have received the configuration. Also, you should consider replacing calls to this with writing to the configuration directly whenever possible.

Properties

$data

Contains the configuration array. This array contains the flattened config from the configuration files (even if these contain arrays to set up the stuff)

private array<string|int, string> $data

$interface

Using a dot notation accessor for this class removes the complexity from this class and allows us to work on caching the data here.

private DotNotationAccessor $interface

Methods

__construct()

public __construct([mixed $data = [] ]) : mixed
Parameters
$data : mixed = []
Return values
mixed

export()

Retrieve a configuration from the repository. You may not retrieve a config as an array.

public export() : mixed
Return values
mixed

get()

Retrieve a configuration from the repository. You may not retrieve a config as an array.

public get(string $key[, mixed $fallback = null ]) : mixed
Parameters
$key : string
$fallback : mixed = null
Return values
mixed

import()

Import the configuration from a file. These files can contain executable code, or environment calls, but whenever caching is enabled the configuration will be computed once and not be regenerated until you request it.

public import(string $namespace, array<string|int, mixed> $values) : mixed
Parameters
$namespace : string
$values : array<string|int, mixed>
Return values
mixed

set()

Set a configuration. Please note that all the code that went before will not have received the configuration. Also, you should consider replacing calls to this with writing to the configuration directly whenever possible.

public set(string $key[, mixed $value = null ]) : Configuration
Parameters
$key : string
$value : mixed = null
Return values
Configuration

Search results