You can then add to an existing configuration by calling the set() method again with the
same environment name:
embed:lithium\tests\cases\core\EnvironmentTest::testModifyEnvironmentConfig(6-6)
The settings for the environment will then be the aggregate of all set() calls:
embed:lithium\tests\cases\core\EnvironmentTest::testModifyEnvironmentConfig(7-7)
By passing an array to $env, you can assign the same configuration to multiple
environments:
embed:lithium\tests\cases\core\EnvironmentTest::testSetMultipleEnvironments(5-7)
The set() method can also be called to manually set which environment to operate in:
embed:lithium\tests\cases\core\EnvironmentTest::testSetAndGetCurrentEnvironment(5-5)
Finally, set() can accept a Request object, to automatically detect the correct
environment.
embed:lithium\tests\cases\core\EnvironmentTest::testEnvironmentDetection(9-10)
For more information on defining custom rules to automatically detect your application's
environment, see the documentation for Environment::is().
public static set ( mixed $env, array $config = null ) : array | ||
$env | mixed | The name(s) of the environment(s) you wish to create, update or switch to (string/array), or a `Request` object or `$_SERVER` / `$_ENV` array used to detect (and switch to) the application's current environment. |
$config | array | If creating or updating a configuration, accepts an array of settings. If the environment name specified in `$env` already exists, the values in `$config` will be recursively merged with any pre-existing settings. |
return | array | If creating or updating a configuration, returns an array of the environment's settings. If updating an existing configuration, this will be the newly-applied configuration merged with the pre-existing values. If setting the environment itself (i.e. `$config` is unspecified), returns `null`. |