Config

Configuration files are stored in the app/config/ folder.

Disco has 6 primary configuration files and 2 development configuration file:

  • config.php - Primary configuration file.
  • dev.config.php - Your local development environment configuration.
  • services.php - Primary services configuration file.
  • factories.php - Primary factories configuration file.
  • email.php - Your email configuration.
  • dev.email.php - Your local development environment email configuration.
  • twig.php - Your twig templating configuration.
  • cache.php - Your phpFastCache configuration.

When your application is in development mode, as defined in config.php by DEV_MODE=true the dev configuration files dev.config.php and dev.email.php will be merged with the production settings if they exist.

config.php #

return Array(

    // The DOMAIN of your application (optional), if not set will be determined automatically.
    'DOMAIN'                   => 'your-site.localhost',

    // Whether to force all requests to HTTPS
    'FORCE_HTTPS'         => false

    // Your Twig Template settings
    'TEMPLATE_EXTENSION'    => Array('.html','.twig'),
    'TEMPLATE_PATH'         => '/app/template/',

    // A value of either true or false
    'DEV_MODE'              => false,


    /// A value of either true or false
    'MAINTENANCE_MODE'      => false,


    // Your Database connection settings
    'DB_ENGINE'            => 'mysql',
    'DB_CHARSET'         => 'utf8',
    'DB_HOST'                => '',
    'DB_USER'                => '',
    'DB_PASSWORD'     => '',
    'DB_DB'                     => '',


    // Your 32 character secure key used for encryption and decryption
    // This is generated upon install for you
    'AES_KEY256'            => '',


    // Your random length secure salts used when creating hashes
    // This is generated upon install for you
    'SHA512_SALT_LEAD'      => '',
    'SHA512_SALT_TAIL'      => ''

);

You can get and set configuration variables during the application life cycle by calling:

$domain = App::config('DOMAIN');
App::config('DOMAIN', 'https://yourdomain.com');

MAINTENANCE_MODE

When maintenance mode is set to true no application logic will be processed and the closure function returned from /app/maintenance.php will be executed.

services.php #

You services configuration file defines the default services that are made available in the application container. Below are the default services that ship with Disco.

return Array(
    'Cache'         => function(){
        $config = require \App::path() . '/app/config/cache.php';
        \phpFastCache::setup($config);
        return phpFastCache();
    },
    'Crypt'         => 'Disco\classes\Crypt',
    'Data'          => 'Disco\classes\Data',
    'DB'            => 'Disco\classes\PDO',
    'Event'         => 'Disco\classes\Event',
    'Email'         => 'Disco\classes\Email',
    'FileHelper'    => 'Disco\classes\FileHelper',
    'Form'          => 'Disco\classes\Form',
    'Html'          => 'Disco\classes\Html',
    'Model'         => 'Disco\classes\ModelFactory',
    'Queue'         => 'Disco\classes\Queue',
    'Request'       => 'Disco\classes\Request',
    'Session'       => 'Disco\classes\Session',
    'Template'      => 'Disco\classes\Template',
    'View'          => 'Disco\classes\View'

);

factories.php #

Your factories configuration file returns the default factory services to register in the application container. Disco does not ship with any default factory services.

email.php #

Your email configuration file defines your applications email servers and accounts. Add as many as you want, so long as the keys are unique!

return Array(

    'DEFAULT_ACCOUNT'       => 'your-account',
    'DEFAULT_SERVER'        => 'your-server',

    // When your app is running in dev mode all emails will be sent to this email address
    'DEV_MODE_SEND_TO'   => null,

    'your-server' => Array(
        'HOST'          => 'mail.messagingengine.com',
        'PORT'          => 465,
        'PROTOCOL'      => 'ssl'
    ),

    'your-account' => Array(
        'EMAIL'         => 'user@youremail.com',
        'PASSWORD'      => 'difficultpassword',
        'ALIAS'         => 'Optional Alias'
    )
);

twig.php #

Configuration for Twig templates, see Twig Environment Options.

return Array(
    'debug'                 => false,
    'charset'               => 'utf-8',
    'base_template_class'   => 'Twig_Template',
    'cache'                 => \App::path() . '/app/template/.cache/',
    'auto_reload'           => true,
    'strict_variables'      => false,
    'autoescape'            => false,
    'optimizations'         => -1
);

cache.php #

Configuration for phpFastCache, see phpFastCache config for more information on how to set configuration options.

return Array(
    'storage'       => 'files',
    'path'          => \App::path() . '/cache/',
    'securityKey'   => 'auto'
);