After installing Glowie into your server, you must configure your application before starting.
app/config/Config.php. This is the file where your application settings for the current environment are stored. Each environment should have its own config file, as some settings may change from one to another.
Important! This file contains sensitive data as database passwords and encryption keys. You should not commit this file to your application source control.
Available configurations are:
Enables caching for some Glowie features. This is highly recommended in a production environment.
'cache' => true,
Enables Skeltch templating engine to compile your application views.
'skeltch' => true,
Default timezone to use with PHP date functions. Must be a valid PHP timezone.
'timezone' => 'America/Sao_Paulo',
The error reporting level for PHP exceptions.
'error_reporting' => E_ALL,
Enables or disables error logging for your application.
'error_log' => true,
Maximum amount of time (in seconds) for storing unused session files.
'session_lifetime' => 120,
Key to use with encrypting functions. Be sure to use a strong key.
'app_key' => 'f08e8ba131c7abab97dba275fab5a85e',
Token to use with encrypting functions (along with your app key). Be sure to use a strong key.
'app_token' => 'd147723d9e91340d9dd28fbd5a0b6651',
Global database connection settings (if applicable). Must be an associative array with the following properties:
- host - Database hostname URL.
- username - Username to use while connecting to the database.
- password - Password to use while autenticating user to the database.
- db - Database name to connect to.
- port - Database connection port.
'database' => [ 'host' => 'localhost', 'username' => 'root', 'password' => '', 'db' => 'glowie', 'port' => 3306 ]
Custom configuration variables
If you want to work with aditional configuration variables, create a new key in the configuration array with the value you want.
'my_config' => 'value'
To retrieve this configuration anywhere in your application, use the static
Config::get() method, passing the key for the configuration you want to retrieve.
use Glowie\Core\Config; $value = Config::get('my_config'); # returns "value"
You can also pass an optional default value as the second parameter, and this value will be returned if the key you provide does not exist in the current environment.
If you want to check if a configuration exists, use the static
Config::has() method, passing the key for the configuration you want to check.
use Glowie\Core\Config; $exists = Config::has('my_config'); # returns true