-
Notifications
You must be signed in to change notification settings - Fork 10
Config
Devin Smith edited this page Feb 3, 2016
·
13 revisions
Tipsy accesses much of its configuration from a single config object
var_dump($tipsy->config());
echo $tipsy->config()['db']['host'];
You can set the config in a config file, multiple config files, or at any point during execution.
$tipsy->config(['view' => [
'path' => 'views',
'layout' => 'awesome-layout'
]]);
Tipsy supports both INI and YAML file formats. YML parsing requires a yml parsing library. You can install one using symfony/yaml
from Packagist, or the yaml_parse_file
function using PECL.
// Tell tipsy to read the config files
$tipsy->config('production.ini');
$tipsy->config('plugins.yml');
// use wildcard selectors
$tipsy->config('config/*.ini');
$tipsy->config('config/*.yml');
$tipsy->config('config/*');
You can combine both INI and YML and it will Recursive Replace the config arrays.
In
db:
user: username
pass: password
driver: mysql
view:
path: views
[db]
host=localhost
[view]
layout=default
Out
{
"db": {
"user": "username",
"pass": "password",
"driver": "mysql",
"host": "localhost"
},
"view": {
"path": "views",
"layout": "default"
}
}
- Home
- Getting Started
- Server Config
- Installation
- Installing Composer
- App
- Route Shorthand
- Config
- Routes
- Methods
- Controller Types
- Params & Regex
- Aliases
- Dependency Injection
- Advanced Routing
- Services
- User Defined Services
- Built in Services
- Middleware
- Views
- Templates
- Scope
- Resource
- Factory
- Looper
- Examples
- Plugins
- About