Create custom configuration files in CakePHP 3

1. Create new file into folder config/
2. Name it whatever you like: myconf.php
3. Add your code:

return [
    /*
     * my configuration
     */
    'myconf' => [
        'setting_1'   =>  'value_1',
        'setting_2'   =>  'value_2',
        'setting_3'   =>  'value_3',
    ],
];

4. Now you have to load it. Open file config/bootstrap.php, locate line:

Configure::load('app', 'default', false);

and append this line underneath:

Configure::load('myconf', 'default');

More about configuration here.

Categories: CakePHP, PHP Tags: , , ,
%d bloggers like this: