Skip to content

Kirby 3.7.5

ready

Inject last minute configuration options

The ready option accepts a callback and makes it possible to inject last minute configurations. The callback is executed when Kirby's instance is ready to be fully used and you can use all roots, urls and other stuff from Kirby to set additional options accordingly.

Examples

/site/config/config.php
<?php

return [
    'ready' => function() {
        return [
            'my.option' => kirby()->root('index') . '/resources'
        ];
    }
];
/site/config/config.php
<?php

return [
    'ready' => function ($kirby) {
        return [
            'db' => [
                'database' => $kirby->root('site') . '/db/database.sqlite',
                'type'     => 'sqlite'
            ]
        ];
    }
];
/site/config/config.php
<?php

return [
    'ready' => function ($kirby) {
        return [
            'debug' => $kirby->user() !== null
        ];
    }
];