bcosca/fatfree — pull request #719 by xfra35 (2014-11-04 18:10:15+00:00)
Title: NEW: custom config section

Hi, here is a proposal for adding a `CONFIG` variable, allowing to handle custom sections in configuration files.

At the moment, any section other than `[routes]`, `[maps]` and `[redirects]` is treated as `[globals]`.

This PR offers to handle custom sections with a custom callback:

```php
$f3->set('CONFIG',function($section,$left,$right){
//being in $section, do something with the $left/$right config values
});
```

This opens a range of possibilities, for example:
```ini
;Development environement
[dev]
api_key = foo

;Production environment
[prod]
api_key = bar
```

or
```ini
;Front
[routes]
GET / = App\Front->home

;Back office
[routes:admin]
GET /admin = App\Backoffice->home
```

or
```ini
;Every property below will be stored in the $f3->get('BLOG') variable
[prefix:BLOG]
param1 = val1
param2 = val2

;Every property below will be stored in the $f3->get('CONTACT') variable
[prefix:CONTACT]
recipients = addr1, addr2
```