Kirby's Query Language API combines the flexibility of Kirby's data structures, the power of GraphQL and the simplicity of REST.
Kirby\Query
classes, profiting from all their enhancementsHelp
class now also supports objects without interceptor that have been explicitly allowed via configKirby\Kql\Interceptors\Interceptor
got merged into Kirby\Kql\Interceptor
. A class alias for the old name has been added.⚠️ Requires Kirby 3.8.2
Kirby\Query
classes, profiting from all their enhancementsHelp
class now also supports objects without interceptor that have been explicitly allowed via configKirby\Kql\Interceptors\Interceptor
got merged into Kirby\Kql\Interceptor
. A class alias for the old name has been added.{
"query": "site.description.kt"
}
<?php
return [
'kql' => [
'auth' => false
]
];
<?php
return [
'kql' => [
'classes' => [
'blocked' => [
'Kirby\Cms\User'
]
],
'methods' => [
'allowed' => [
'AlbumPage::cover'
],
'blocked' => [
'Kirby\Cms\App::version'
]
]
]
];
You can also use doc block comments in custom model methods, custom page methods, etc. to allow a method in KQL
class AlbumPage extends Page
{
/**
* @kql-allowed
*/
public function cover()
{
return $this->images()->findBy('name', 'cover') ?? $this->image();
}
}
<?php
return [
'kql' => [
'interceptors' => [
'Kirby\Cms\System' => 'SystemInterceptor'
]
]
];
{
"query": "collection('notes')"
}
{
"query": "site.description.kt"
}
<?php
return [
'kql' => [
'auth' => false
]
];
<?php
return [
'kql' => [
'classes' => [
'blocked' => [
'Kirby\Cms\User'
]
],
'methods' => [
'allowed' => [
'AlbumPage::cover'
],
'blocked' => [
'Kirby\Cms\App::version'
]
]
]
];
You can also use doc block comments in custom model methods, custom page methods, etc. to allow a method in KQL
class AlbumPage extends Page
{
/**
* @kql-allowed
*/
public function cover()
{
return $this->images()->findBy('name', 'cover') ?? $this->image();
}
}
<?php
return [
'kql' => [
'interceptors' => [
'Kirby\Cms\System' => 'SystemInterceptor'
]
]
];
{
"query": "collection('notes')"
}
It's time to make it official. With the latest changes, KQL is ready to be used with the latest Kirby version and has now full support for the new Blocks and Layouts.
Have fun :)