Configuration


Description


The configuration of the Mako Framework core is done in the index.php file. This is where you set the error reporting level, enable internal caching define the paths to the application and framework directories.

You do not need to edit the paths unless you move the application and framework directories out of your webserver's document root.

All of the remaining framework configuration is done by editing the files that are located in the app/config directory.


Config Files


Mako Framework config files are just simple arrays:


<?php

return array
(
  'key_1' => 'value',
  'key_2' => 'value',
);

And loading a config file is done by using the Config::get method.


$config = Config::get('redis'); // Loads the redis.php file

You can also fetch config items using "dot notation":


$default = Config::get('redis.default');

It is also easy to override settings or add new configurations:


// Adds a new Crypto configuration named "user" that you can 
// use when creating a Crypto instance "Crypto::instance('user');"

Config::set('crypto.configurations.user', array
(
  'library' => 'mcrypt',
  'cipher'  => MCRYPT_RIJNDAEL_256,
  'key'     => 'ksMGBr_yR>=IiRicJFUhD4XlRnE%|11mvRGNJsD',
  'mode'    => MCRYPT_MODE_ECB,
));

Removing the custom configuration is done using the Config::delete method:


Config::delete('crypto.configurations.user');

Main configuration


The main main configuration of the framework is located in app/config/mako.php.


Key Description
base_url The base url of your application (e.g., http://www.example.org) without a trailing slash. The framework will try to autodetect the URL if no value is given.
clean_urls Set to TRUE to hide "index.php" from your urls. This requires mod_rewrite and a .htaccess file.
asset_location URL or path to your asset directory (without trailing slash).
charset Default character set used internally in the framework.
timezone Set the default timezone used by various PHP date functions.
locale → locales Array of locales to try until success. You can also set the value to NULL to use the default locale.
locale → lc_numeric Set to TRUE to set LC_NUMERIC to the locale you specified.
aliases Class aliases. The key is the original class name and the value is the alias.
packages Array of packages to initialize by default.
lang_cache Setting this value to true can speed up execution by reducing the language files to include.
compress_output Setting this to true will reduce bandwidth usage while slightly increasing the CPU usage.
error_handler → enable Set to TRUE to enable the Mako error handler.
error_handler → display_errors Set to TRUE to display errors caught by the mako error handlers. It is recommended to set this value to FALSE when you are in production.
error_handler → log_errors Set to TRUE if you want to log errors caught by the Mako errors handlers.