Config
All application configuration is in App/Config folder.
There you can have 2 files: local.php and global.php
global.php file is overwritten by the file local.php
A minimal configuration looks like this:
return array( 'language_code' => 'en', 'database' => array( 'type' => 'mysql', 'host' => '', 'name' => '', 'user' => '', 'password' => '', ), 'settings_table' => 'crt_settings', 'session_prefix' => 'crt_', 'default_timezone' => 'Europe/Bucharest', 'crater_error_handler' => true, 'default_template' => 'default', );
- language_code: Default language of application
- database: Database connection parameters (necessary only if you use databases)
- settings_table: Name of settings table (necessary only if you use databases)
- session_prefix: The prefix is highly recommended, its very useful when sharing databases with other applications, to avoid conflicts.
- default_timezone: The timezone to your local
- crater_error_handler: enable/disable the custom error logger
- default_template: Set the default template of application
Config system is designed to simplify access to configuration data within applications. Do you have a configuration file like the one below:
return array( /* ... */ 'default_timezone' => 'Europe/Bucharest', 'crater_error_handler' => true, 'default_template' => 'default', 'services' = array( 'facebook' => array( 'app_id' => 1234, 'secret' => 'abcdefghijklm' ) ) );
For accessing the Facebook credentials in your controller, you will use:
$config = new \Core\Config(); $facebook = $config->getConfig()['services']['facebook']; $appId = $facebook['app_id']; $secret = $facebook['secret'];↑