Config



Config

Settings for the framework setup in app/Config.php and app/Config/

Set the prefix for the database:

/**
 * PREFER to be used in Database calls or storing Session data, default is 'nova_'
 */
define('PREFIX', 'nova_');

The prefix is optional but highly recommended, it's very useful when sharing databases with other applications, to avoid conflicts. The prefix should be the starting pattern of all table names like nova_users

/**
 * Setup the Config API Mode.
 * For using the 'database' mode, you need to have a database, with a table generated by 'scripts/nova_options.sql'
 */
define('CONFIG_STORE', 'files'); // Supported: "files", "database"

App

When the Environment is set to development, in webroot/index.php the debug mode will be set to true.

'debug' => (ENVIRONMENT == 'development'), // When enabled the actual PHP errors will be shown.

You can set the environment in webroot/index.php. At default, the environment will be set to development.

Assign the site url

'url'  => 'http://www.novaframework.dev/',

Assign the admin's email.

'email' => 'admin@novaframework.dev',

Assign the site name

'name' => 'Nova 3.0',

Set the default template

'theme' => 'Bootstrap',

Set the backend's colour scheme, used for the dashboard module.

'color_scheme' => 'blue',

Assign the default locale, used for translation.

'locale' => 'en',
/**
 * The default Timezone for your website.
 * http://www.php.net/manual/en/timezones.php
 */
'timezone' => 'Europe/London',

Assign encryption key, you can use php nova make:key in a terminal window/ssh or generate a key by going to http://novaframework.com/token-generator

key' => 'SomeRandomStringThere_1234567890'

Turn on csrf

'csrf' => true

Service providers

'providers' => array(
    'Auth\AuthServiceProvider',
    'Cache\CacheServiceProvider',
    'Routing\RoutingServiceProvider',
    'Cookie\CookieServiceProvider',
    'Module\ModuleServiceProvider',
    'Database\DatabaseServiceProvider',
    'Encryption\EncryptionServiceProvider',
    'Filesystem\FilesystemServiceProvider',
    'Hashing\HashServiceProvider',
    'Log\LogServiceProvider',
    'Mail\MailServiceProvider',
    'Pagination\PaginationServiceProvider',
    'Redis\RedisServiceProvider',
    'Auth\Reminders\ReminderServiceProvider',
    'Session\SessionServiceProvider',
    'Language\LanguageServiceProvider',
    'Validation\ValidationServiceProvider',
    'Html\HtmlServiceProvider',
    'View\ViewServiceProvider',
    'Template\TemplateServiceProvider',
    'Cron\CronServiceProvider',
)

Set manifest path

'manifest' => STORAGE_PATH

Set alias paths - these allow shorter access to the methods without having to call the full path in views.

'aliases' => array(
   // The Helpers.
    'Assets'        => 'Helpers\Assets',
    'Date'          => 'Helpers\Date',
    'Document'      => 'Helpers\Document',
    'Ftp'           => 'Helpers\Ftp',
    'GeoCode'       => 'Helpers\GeoCode',
    'Inflector'     => 'Helpers\Inflector',
    'Number'        => 'Helpers\Number',
    'RainCaptcha'   => 'Helpers\RainCaptcha',
    'ReservedWords' => 'Helpers\ReservedWords',
    'SimpleCurl'    => 'Helpers\SimpleCurl',
    'TableBuilder'  => 'Helpers\TableBuilder',
    'Tags'          => 'Helpers\Tags',

    // The Forensics Console.
    'Console'       => 'Forensics\Console',

    // The Support Classes.
    'Arr'           => 'Support\Arr',
    'Str'           => 'Support\Str',

    // The Support Facades.
    'App'           => 'Support\Facades\App',
    'Auth'          => 'Support\Facades\Auth',
    'Cache'         => 'Support\Facades\Cache',
    'Config'        => 'Support\Facades\Config',
    'Cookie'        => 'Support\Facades\Cookie',
    'Crypt'         => 'Support\Facades\Crypt',
    'DB'            => 'Support\Facades\DB',
    'Event'         => 'Support\Facades\Event',
    'File'          => 'Support\Facades\File',
    'Hash'          => 'Support\Facades\Hash',
    'Input'         => 'Support\Facades\Input',
    'Language'      => 'Support\Facades\Language',
    'Mailer'        => 'Support\Facades\Mailer',
    'Paginator'     => 'Support\Facades\Paginator',
    'Password'      => 'Support\Facades\Password',
    'Redirect'      => 'Support\Facades\Redirect',
    'Redis'         => 'Support\Facades\Redis',
    'Request'       => 'Support\Facades\Request',
    'Response'      => 'Support\Facades\Response',
    'Route'         => 'Support\Facades\Route',
    'Session'       => 'Support\Facades\Session',
    'Validator'     => 'Support\Facades\Validator',
    'Log'           => 'Support\Facades\Log',
    'URL'           => 'Support\Facades\URL',
    'Form'          => 'Support\Facades\Form',
    'HTML'          => 'Support\Facades\HTML',
    'Template'      => 'Support\Facades\Template',
    'View'          => 'Support\Facades\View',
    'Cron'          => 'Support\Facades\Cron',
    'Module'        => 'Support\Facades\Module',
);

Auth

Configuration options for use within the Auth system.

Set default authentication driver, can be database or extended

'driver' => 'extended'

Set authentication model

'model' => 'App\Models\User'

Set authentication table

'table' => 'users'

Password Reminder Settings

/*
| Here you may set the settings for password reminders, including a view
| that should be used as your password reminder e-mail. You will also
| be able to set the name of the table that holds the reset tokens.
|
| The "expire" time is the number of minutes that the reminder should be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
*/
'reminder' => array(
    'email'  => 'Emails/Auth/Reminder',
    'table'  => 'password_reminders',
    'expire' => 60,
)

cache

Set Default driver, options: . files . database . auto . apc . memcached . redis *. array

'driver'   =>  'files'

Default Memcache Server for all $cache

'memcached' => array(
     array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 100),
 ),

Database

Config options:

Set PDO fetch style

'fetch' => PDO::FETCH_CLASS

The Default Database Connection Name

'default' => 'mysql'

Set connections, additional databases can be used by adding additional arrays:

// The Database Connections.
'connections' => array(
    'sqlite' => array(
        'driver'    => 'sqlite',
        'database'  => APPDIR .'Storage' .DS .'database.sqlite',
        'prefix'    => '',
    ),
    'mysql' => array(
        'driver'    => 'mysql',
        'hostname'  => 'localhost',
        'database'  => 'nova',
        'username'  => 'nova',
        'password'  => 'password',
        'prefix'    => PREFIX,
        'charset'   => 'utf8',
        'collation' => 'utf8_general_ci',
    ),
    'pgsql' => array(
        'driver'   => 'pgsql',
        'host'     => 'localhost',
        'database' => 'nova',
        'username' => 'nova',
        'password' => 'password',
        'charset'  => 'utf8',
        'prefix'   => PREFIX,
        'schema'   => 'public',
    ),
),

Languages

Array of all supported languages

Config::set('languages', array(
    'cz' => array('info' => 'Czech',     'name' => 'čeština',    'locale' => 'cz_CZ', 'dir' => 'ltr'),
    'da' => array('info' => 'Danish',    'name' => 'Dansk',      'locale' => 'da_DK', 'dir' => 'ltr'),
    'de' => array('info' => 'German',    'name' => 'Deutsch',    'locale' => 'de_DE', 'dir' => 'ltr'),
    'en' => array('info' => 'English',   'name' => 'English',    'locale' => 'en_US', 'dir' => 'ltr'),
    'es' => array('info' => 'Spanish',   'name' => 'Español',    'locale' => 'es_ES', 'dir' => 'ltr'),
    'fa' => array('info' => 'Persian',   'name' => 'پارسی',      'locale' => 'fa_IR', 'dir' => 'rtl'),
    'fr' => array('info' => 'French',    'name' => 'Français',   'locale' => 'fr_FR', 'dir' => 'ltr'),
    'it' => array('info' => 'Italian',   'name' => 'italiano',   'locale' => 'it_IT', 'dir' => 'ltr'),
    'ja' => array('info' => 'Japanesse', 'name' => '日本語',      'locale' => 'ja_JA', 'dir' => 'ltr'),
    'nl' => array('info' => 'Dutch',     'name' => 'Nederlands', 'locale' => 'nl_NL', 'dir' => 'ltr'),
    'pl' => array('info' => 'Polish',    'name' => 'polski',     'locale' => 'pl_PL', 'dir' => 'ltr'),
    'ro' => array('info' => 'Romanian',  'name' => 'Română',     'locale' => 'ro_RO', 'dir' => 'ltr'),
    'ru' => array('info' => 'Russian',   'name' => 'ру́сский',    'locale' => 'ru_RU', 'dir' => 'ltr'),
));

Mail

Mail settings:

Config::set('mail', array(
    'driver' => 'smtp',
    'host'   => '',
    'port'   => 587,
    'from'   => array(
        'address' => 'admin@novaframework.dev',
        'name'    => 'The Nova Staff',
    ),
    'encryption' => 'tls',
    'username'   => '',
    'password'   => '',
    'sendmail'   => '/usr/sbin/sendmail -bs',

    // Whether or not the Mailer will pretend to send the messages.
    'pretend' => true,
));

Modules

Set path to where modules are located

'path' => APPDIR .'Modules',

Set namespace for modules

'namespace' => 'App\Modules\\',

To activate modules place the module name in this array.

'modules' => array(
        'demos' => array(
            'namespace' => 'Demos',
            'enabled'   => true,
            'order'     => 10001,
        ),
        'files' => array(
            'namespace' => 'Files',
            'enabled'   => true,
            'order'     => 9001,
        ),
        'system' => array(
            'namespace' => 'System',
            'enabled'   => true,
            'order'     => 8001,
        ),
        'users' => array(
            'namespace' => 'Users',
            'enabled'   => true,
            'order'     => 9001,
        ),
    ),

Profiler

You can set these options to true, if you need help with debugging, by default database number of sql queries is logged in the profiler seen at the bottom of the default theme

/**
 * Setup the Profiler configuration
 */
Config::set('profiler', array(
    'useForensics' => false,
    'withDatabase' => false,
));

When the debug setting is set in app/Config/App.php (on by default) the following metrics are shown on the default and AdminLTE theme:

Elapsed Time: 0.1120 sec | Memory Usage: 4.35MB | SQL: 0 queries | UMAX: 223

Elapsed Time Total time executed in seconds

Memory Usage Total memory in MB used

SQL When withDatabase setting is true the total number of queries ran

UMAX UMAX represents a estimation of the maximum number of pages served per second, you can use UMAX as a general speed evaluation on a reasonable server load. Bigger is the number given by UMAX, better is it.

Routing Configuration

Assets routing:

return array(
    /*
     * The Asset Files Serving configuration.
     */
    'assets' => array(
        // The driver type used for serving the Asset Files.
        'driver' => 'default',                                  // Supported: "default", "custom".

        // The Assets Dispatcher used while the driver is on 'custom' mode.
        'dispatcher' => 'Shared\Routing\Assets\CustomDispatcher',

        // Wheter or not the CSS and JS files are automatically compressed.
        'compress' => true,

        // The browser Cache Control options.
        'cache' => array(
            'ttl'          => 600,
            'maxAge'       => 10800,
            'sharedMaxAge' => 600,
        ),

        // The Valid Vendor Paths - be aware that improper configuration of the Valid Vendor Paths could introduce
        // severe security issues, try to limit the access to a precise area, where aren't present "unsafe" files.
        //
        // '/vendor/almasaeed2010/adminlte/dist/css/AdminLTE.min.css'
        //          ^____________________^____^____________________Those are the parts of path which are validated.
        //
        'paths' => array(
            'almasaeed2010/adminlte' => array(
                'bootstrap',
                'dist',
                'plugins'
            ),
            'twbs/bootstrap' => 'dist',
        ),
    ),
);

reCAPTCHA

/**
 * Setup the Google reCAPTCHA configuration
 */
Config::set('recaptcha', array(
    'active'  => false,
    'siteKey' => '',
    'secret'  => '',
));

Session

Set session options


Config::set('session', array(
    'driver' => 'file', // The Session Driver used for storing Session data; supported: 'file', 'database' or 'cookie'.

    // The Database Session Driver configuration.
    'table'      => 'sessions', // The Database Table hosting the Session data.
    'connection' => null,       // The Database Connection name used by driver.

    // Session Lifetime.
    'lifetime'      => 180,   // Number of minutes the Session is allowed to remain idle before it expires.
    'expireOnClose' => false, // If you want them to immediately expire on the browser closing, set that.

    // The File Session Driver configuration.
    'files'    => STORAGE_PATH .'Sessions',   // File Session Handler - where the Session files may be stored.
    'lottery'  => array(2, 100), // Option used by the Garbage Collector, to remove the stalled Session files.

    // Cookie configuration.
    'cookie'   => PREFIX .'session',
    'path'     => '/',
    'domain'   => null,
    'secure'   => false,
));