Keeper contains the next bootloaders:
Spiral\Keeper\Bootloader\KeeperBootloader
is the entrypoint for all other bootloadersSpiral\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 = [
Bootloader\SitemapBootloader::class,
Bootloader\AnnotatedBootloader::class,
];
protected const MIDDLEWARE = [
Middleware\LoginMiddleware::class
];
protected const INTERCEPTORS = [
CycleInterceptor::class,
GuardInterceptor::class,
FilterInterceptor::class,
GridInterceptor::class,
];
}
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.
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).
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.