Documentation

Environment
in package

The environment loads settings from an ini file, and from the system's environment, making them accessible to the application.

If you use config caching you should not use this outside of the config files, since the data in the environment gets 'baked' into the config and cached to a file.

Tags
author

César de la Cal cesar@magic3w.com

Table of Contents

$settings  : mixed
Default settings. This array contains the settings that are predefined in Spitfire. They can later be overriden if needed by using set inside of each environment.
__construct()  : mixed
Loads the environment file from disk and initializes an environment for the application, please note that the envioronment file is always loaded from a location relative to the application root.
get()  : string|Environment
Static version of read. Will return the selected key from the currently active environment.
read()  : mixed
Returns the selected key from the settings.
set()  : mixed
This function creates / overrides a setting with a value defined by the developer. Names are case insensitive.
subtree()  : mixed
This method has been deprecated, the system should not use the subtree method to explore system configuration, instead, it should use service providers for this and refer to the config only with known keys.

Properties

$settings

Default settings. This array contains the settings that are predefined in Spitfire. They can later be overriden if needed by using set inside of each environment.

protected mixed $settings = []

Methods

__construct()

Loads the environment file from disk and initializes an environment for the application, please note that the envioronment file is always loaded from a location relative to the application root.

public __construct([mixed $env = '.env' ]) : mixed

Using an environment file outside the application root is usually not advisable, and may lead to unexpected behavior.

Parameters
$env : mixed = '.env'
Return values
mixed

get()

Static version of read. Will return the selected key from the currently active environment.

public static get([string $key = null ]) : string|Environment
Parameters
$key : string = null

The key to be returned.

Tags
deprecated

since v0.2

Return values
string|Environment

read()

Returns the selected key from the settings.

public read(string $key) : mixed
Parameters
$key : string

The key to be returned.

Return values
mixed

set()

This function creates / overrides a setting with a value defined by the developer. Names are case insensitive.

public set(string $key, string $value) : mixed
Parameters
$key : string

The name of the setting

$value : string

The value of the parameter.

Tags
deprecated

since v0.2 ()

Return values
mixed

subtree()

This method has been deprecated, the system should not use the subtree method to explore system configuration, instead, it should use service providers for this and refer to the config only with known keys.

public subtree(mixed $namespace) : mixed
Parameters
$namespace : mixed
Tags
deprecated

since 0.2-dev

see
https://phabricator.magic3w.com/T69

for further notes

Return values
mixed

Search results