All of the configuration files for the Wiggum framework are stored in the config
directory.
There are also a number of config settings that are required by the Wiggum framework. These are stored in the app.php
configuration file.
<?php
/************************/
/* app config */
/************************/
return [
'environment' => 'development', //required
'timezone' => 'America/Toronto', //required
'boot' => [
'services' => 'app/boot/services.php', //required
'middleware' => 'app/boot/middleware.php', //required
'routes' => 'app/boot/routes.php' //required
]
];
You can also add your application-specific settings to this file as well:
<?php
/************************/
/* app config */
/************************/
return [
'environment' => 'development', //required
'timezone' => 'America/Toronto', //required
'domain' => 'https://example.com',
'path' => [
'public' => 'public',
'storage' => 'public/storage',
],
'datetime' => 'Y-m-d H:i:s',
'boot' => [
'services' => 'app/boot/services.php', //required
'middleware' => 'app/boot/middleware.php', //required
'routes' => 'app/boot/routes.php' //required
]
];
Settings are stored in the Application object and are retrived using dot notation as keys. This can return a string
, array
or null
if nothing is found.
In the below example, the first term in the dot notiation app
refers to the file app.php
in the
$this->app->config->get('app.path.storage');
In this example a array will be returned:
$this->app->config->get('app.path');
The get method has an optional second paramater, to set as a default value if the setting was not found.
$this->app->config->get('app.path.storage', 'some/path');
The has($key)
can be used to check if a setting exists. It returns boolean true
or false
.
$this->app->config->has('app.path.storage');
If you need to add or update settings stored after the application cycle has initialized, you can use the set method. For example:
$this->app->config->set('app.datetime', 'l jS \of F Y h:i:s A');