Revision: Fri, 31 May 2024 16:10:59 GMT
v3.11 – outdated
This version of the documentation is outdated. Consider upgrading your project to Spiral Framework 3.12
Edit this page

Keeper — Bootloaders

Keeper contains the next bootloaders:

  • Spiral\Keeper\Bootloader\KeeperBootloader is the entrypoint for all other bootloaders
  • Spiral\Keeper\Bootloader\GuestBootloader grants full access to guest users (use it only for tests)
  • Spiral\Keeper\Bootloader\AnnotatedBootloader reads Controller and Action annotations ( see Routing)
  • Spiral\Keeper\Bootloader\SitemapBootloader reads the sitemap annotations, can also be used for Sitemap definition via code (see Sitemap)
  • Spiral\Keeper\Bootloader\UIBootloader registers keeper views - layout, sidebar, breadcrumbs, grids, etc. ( see Sitemap and Views)


Spiral\Keeper\Bootloader\KeeperBootloader is abstract. First of all create your own inherited bootloader. If needed, all the rest of keeper bootloaders should be registered in LOAD const.

use App\Bootloader\Keeper;
use Spiral\DataGrid\Interceptor\GridInterceptor;
use Spiral\Domain\CycleInterceptor;
use Spiral\Domain\FilterInterceptor;
use Spiral\Domain\GuardInterceptor;
use Spiral\Keeper\Bootloader;
use Spiral\Keeper\Middleware;

class KeeperBootloader extends Bootloader\KeeperBootloader
    protected const NAMESPACE          = 'keeper';
    protected const PREFIX             = 'keeper/';
    protected const DEFAULT_CONTROLLER = 'dashboard';
    protected const CONFIG_NAME        = '';

    protected const LOAD = [

    protected const MIDDLEWARE = [

    protected const INTERCEPTORS = [


You can define the current keeper namespace using NAMESPACE const. keeper is by default.


You can define the current route prefix using PREFIX const. keeper/ is by default.

Default Controller

You can define the default route controller using DEFAULT_CONTROLLER const. Default action can be declared only via config file (or, if set, defaultAction annotation property or index method).

Config name

You can define the config name for the current keeper namespace using CONFIG_NAME const. If omitted, NAMESPACE const value will be used.


You can list custom middlewares in the MIDDLEWARE const. Additional middlewares can be applied in the routes separately for each route, both sets will be applied.


You can list custom interceptors in the INTERCEPTORS const.


Keeper config can be fully declared in the config file.

Config file should be stored in the app config directory.

return [
   'routePrefix'   => '',
   'routeDefaults' => ['controller' => '', 'action' => ''],
   'loginView'     => 'keeper:login',
   'middleware'    => [],
   'modules'       => [],
   'interceptors'  => [],

Prefix, default controller, list of middlewares, modules' bootloaders and interceptors from the constants are used as config defaults.