Asatru PHP Documentation


Project maintained by asatru-php Hosted on GitHub Pages — Theme by mattgraham

Config management

The framework offers the possibility to load configuration data from config scripts from the app/config directory.

For instance you can have the config file app/config/test.php with the following content:

<?php

return [
    'attr' => 'value',
    'more' => [
        //More data
    ]
];

You can now query the config data like this:

<?php

$data = config('test');

//Or if in a sub directory
$data = config('folder/test');

If the config script returns an array then it is returned as object by default. In order to turn off this behaviour and return the array instead, simply pass ‚false‘ as second argument.

<?php

$data = config('test', false);