Config

Config

Settings for the framework setup in app/Config.php

Set the timezone to your local

date_default_timezone_set('Europe/London');

Next, set the application web URL, Once the SITEURL is set it can be used to get the application address.

define('SITEURL', 'http://example.com/');

Set the base URL? if on the root of a domain it's a single '/' otherwise it's /foldername/

define('DIR', '/');

If using a database the database credentials will need adding:

define('DB_TYPE', 'mysql');
define('DB_HOST', 'localhost');
define('DB_NAME', 'database name');
define('DB_USER', 'root');
define('DB_PASS', 'root');
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 likenova_users

Nova provides a session helper class, in order to avoid session conflicts a prefix is used.

define('SESSION_PREFIX', 'nova_');

The following tells the framework what theme folder to use for views

define('TEMPLATE','default');

Set the default language

define('LANGUAGE_CODE', 'en');

set the application name:

define('SITETITLE', 'Nova');

Set encryption key - used for encrypting cookies

define('ENCRYPT_KEY', '');

By default errors are logged but not displayed, to display them set this to true

Config::set('logger', array(
'displayErrors' => false,
));

The default theme comes with a profiler, similar to browsers inspector to turn on:

Config::set('profiler', array(
'useForensics' => false,
'withDatabase' => false,
));

App

Turn debugging on by setting to true

'debug' => false

Assign the defined site url

'url'  => SITEURL

Assign the site name

'name' => SITETITLE

Turn on multilingual support

'multilingual' => false,

'locale' => LANGUAGE_CODE

Assign encryption key

key' => ENCRYPT_KEY

Turn on csrf

'csrf' => true

Service providers

'providers' => array(
'Auth\AuthServiceProvider',
'Cache\CacheServiceProvider',
'Routing\RoutingServiceProvider',
'Cookie\CookieServiceProvider',
'Database\DatabaseServiceProvider',
'Encryption\EncryptionServiceProvider',
'Hashing\HashServiceProvider',
'Log\LogServiceProvider',
'Mail\MailServiceProvider',
'Pagination\PaginationServiceProvider',
'Auth\Reminders\ReminderServiceProvider',
'Session\SessionServiceProvider',
'Validation\ValidationServiceProvider',
)

Set manifest path

'manifest' => STORAGE_PATH

Set alias paths

'aliases' => array(
// The Core Tools.
'Errors' => '\Core\Error', // The Helpers.
'Mail' => '\Helpers\Mailer',
'Assets' => '\Helpers\Assets',
'Csrf' => '\Helpers\Csrf',
'Date' => '\Helpers\Date',
'Document' => '\Helpers\Document',
'Encrypter' => '\Helpers\Encrypter',
'FastCache' => '\Helpers\FastCache',
'Form' => '\Helpers\Form',
'Ftp' => '\Helpers\Ftp',
'GeoCode' => '\Helpers\GeoCode',
'Hooks' => '\Helpers\Hooks',
'Inflector' => '\Helpers\Inflector',
'Number' => '\Helpers\Number',
'RainCaptcha' => '\Helpers\RainCaptcha',
'ReservedWords' => '\Helpers\ReservedWords',
'SimpleCurl' => '\Helpers\SimpleCurl',
'TableBuilder' => '\Helpers\TableBuilder',
'Tags' => '\Helpers\Tags',
'Url' => '\Helpers\Url', // 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\Database',
'Event' => '\Support\Facades\Event',
'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',
'Request' => '\Support\Facades\Request',
'Response' => '\Support\Facades\Response',
'Session' => '\Support\Facades\Session',
'Validator' => '\Support\Facades\Validator',
'Log' => '\Support\Facades\Log'
)

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 storage, options: . ssdb . predis . redis . mongodb . files . sqlite . auto . apc . wincache . xcache . memcache . memcached

'storage'   =>  'files'

Default Path for Cache on HDD. Use full PATH like /home/username/cache. Keep it blank '', it will automatic setup for you.

Set path

'path' =>  STORAGE_PATH .'Cache' , // default path for files
'securityKey' => '',

FallBack Driver Example, in your code, you use memcached, apc..etc, but when you moved your web hosting until you setup your new server caching, use 'overwrite' => 'files'

'overwrite' => 'files', // whatever caching will change to 'files' and you don't need to change ur code

Default Memcache Server for all $cache

'server'    =>  array(
array('127.0.0.1',11211,1),
)

Cache settings:

'memcache' => array(
array('127.0.0.1', 11211, 1),
//array('new.host.ip',11211,1),
),
'redis' => array(
'host' => '127.0.0.1',
'port' => '',
'password' => '',
'database' => '',
'timeout' => '',
),
'ssdb' => array(
'host' => '127.0.0.1',
'port' => 8888,
'password' => '',
'timeout' => '',
),
// use 1 as normal traditional, 2 = phpfastcache fastest as default, 3 = phpfastcache memory stable
'caching_method' => 2,

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:

'connections' => array(
'sqlite' => array(
'driver' => 'sqlite',
'database' => APPDIR .'Storage' .DS .'database.sqlite',
'prefix' => '',
),
'mysql' => array(
'driver' => DB_TYPE,
'hostname' => DB_HOST,
'database' => DB_NAME,
'username' => DB_USER,
'password' => DB_PASS,
'prefix' => PREFIX,
'charset' => 'utf8',
'collation' => 'utf8_general_ci',
),
'pgsql' => array(
'driver' => 'pgsql',
'host' => 'localhost',
'database' => 'database',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'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' => SITETITLE,
),
'encryption' => 'tls',
'username' => '',
'password' => '',
'sendmail' => '/usr/sbin/sendmail -bs', // Whether or not the Mailer will pretend to send the messages.
'pretend' => true,
));

Modules

To activate modules place the module name in this array

Config::set('modules', array(
'Dashboard',
'Settings',
'Demos',
'Users',
));

Routing

These options allow routing patterns to be defined

Config::set('routing', array(
'patterns' => array(
//':hex' => '[[:xdigit:]]+',
)
));

Session

Set session options

Config::set('session', array(
'driver' => 'file', // The Session Driver used for storing Session data; supported: 'file' or 'database'. 'handler' => '\Session\FileSessionHandler', // The default Session Handler, using files for Session cache. // Storage configuration.
'lifetime' => 180, // Number of minutes the Session is allowed to remain idle before it expires.
'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, // weather or not will be used the Cookies encryption.
'encrypt' => true
));

Config的更多相关文章

  1. 一步步开发自己的博客 .NET版(11、Web.config文件的读取和修改)

    Web.config的读取 对于Web.config的读取大家都很属性了.平时我们用得比较多的就是appSettings节点下配置.如: 我们对应的代码是: = ConfigurationManage ...

  2. Discuz NT 架构剖析之Config机制

    接触了Discuz NT! 一段时间了,是时候做个总结了,标题好霸气,有木有? 都是托园子里的大牛代振军的福啊,哈哈哈哈. 首先论坛的信息不是完全存储在数据库里面的,一部分信息存储在config文件里 ...

  3. [笔记]HAproxy reload config file with uninterrupt session

    HAProxy is a high performance load balancer. It is very light-weight, and free, making it a great op ...

  4. MyBatis2:config.xml文件

    前言 前一篇文章,讲了MyBatis入门,讲到了MyBatis有两个基本的配置文件,一个用来配置环境信息,一个用来写SQL语句.前者我把它命名为config.xml,config.xml的内容是: & ...

  5. 搞了我一下午竟然是web.config少写了一个点

    Safari手机版居然有个这么愚蠢的bug,浪费了我整个下午,使尽浑身解数,国内国外网站搜索解决方案,每一行代码读了又想想了又读如此不知道多少遍,想破脑袋也想不通到底哪里出了问题,结果竟然是web.c ...

  6. WCF中,通过C#代码或App.config配置文件创建ServiceHost类

    C# static void Main(string[] args) { //创建宿主的基地址 Uri baseAddress = new Uri("http://localhost:808 ...

  7. myeclipse 无法启动 java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini).

    把myeclipse10 按照目录完整拷贝到了另外一台电脑, 另外的目录 原安装目录 D\:\soft\i\myeclipse10 新安装目录 E\:\soft\myeclipse10 双击启动失败, ...

  8. PHP扩展-如何使用文件config.m4

    config.m4文件用于指定正在开发的扩展在类unix系统下构建时支持的选项,指定此扩展需要哪些库以及哪些源文件:使用 GNU autoconf 语法编写.注意需要重新执行phpize,config ...

  9. RabbitMQ Config

    默认访问地址:http://localhost:15672/ 要想修改内网访问: %APPDATA%\RabbitMQ\ 目录下添加文件 rabbitmq.config [ {rabbit, [%% ...

  10. C# 读取app.config配置文件 节点键值,提示 "配置系统未能初始化" 错误的解决方案

    新建C#项目,在app.config中添加了appSettings项,运行时出现"配置系统未能初始化"的错误,MSDN里写到,如果配置文件中包含 configSections 元素 ...

随机推荐

  1. (二)学习C#之内存管理

    一.当你运行你的程序通常都会访问哪些内存空间呢? 电脑自言自语道,“这个人要声明一个整数”或“这个人个方法”或“这个人要创建一个对象” 1.这些信息究竟是存在内存里的什么地方呢? 2.或者说用于描述这 ...

  2. android捕获ListView中每个item点击事件

    转自:http://www.cnblogs.com/pswzone/archive/2012/03/10/2389275.html package com.wps.android;   import  ...

  3. How to Convert a Date Time to “X minutes ago” in C# z

    http://www.codeproject.com/Articles/770323/How-to-Convert-a-Date-Time-to-X-minutes-ago-in-Csh In one ...

  4. linux常识

    一.linux常识 1.为什么学习linux及如何学习linux? 基于linux的操作系统是一种自由和开放源代码的类UNIX操作系统,其定义组件是linux内核,其稳定性.安全性.处理多并发已经得到 ...

  5. 设计模式_State_状态模式

    形象例子: 跟MM交往时,一定要注意她的状态哦,在不同的状态时她的行为会有不同,比如你约她今天晚上去看电影,对你没兴趣的MM就会说“有事情啦”,对你不讨厌但还没喜欢上的MM就会说“好啊,不过可以带上我 ...

  6. Android UI -- 的基础知识。

    在介绍基础知识之前先明确几个基本的概念 View 视图是所有可视组件的基类,所有的UI控件包括布局类都是从View派生出来的. ViewGroup ViewGroup是View的扩展,可以放置多个Vi ...

  7. bzoj 3263 陌上花开(cdq分治,BIT)

      [题意] 求满足Ai<=Aj,Bi<=Bj,Ci<=Cj的数对的数目. [思路] cdq分治 借网上一句话:第一维排序,第二维cdq分治,第三维树状数组维护. 首先合并三维都是相 ...

  8. NOIP2014 生活大爆炸版石头剪刀布

    生活大爆炸版石头剪刀布 (rps.cpp/c/pas) [问题描述] 石头剪刀布是常见的猜拳游戏:石头胜剪刀,剪刀胜布,布胜石头.如果两个人出拳一样,则不分胜负.在<生活大爆炸>第二季第8 ...

  9. BestCoder Round #68 (div.2) 1002 tree

    题意:给你一个图,每条边权值0或1,问每个点周围最近的点有多少个? 思路:并查集找权值为0的点构成的连通块. #include<stdio.h> #include<string.h& ...

  10. codeforce--600D - Area of Two Circles' Intersection

    题意:求相交圆的面积.借鉴大神代码,精度超高. #include <fstream> #include <iostream> #include <string> # ...