johannschopplich / kirby-headless
KQL, JSON templates, and API routes for Kirby CMS
Package info
github.com/johannschopplich/kirby-headless
Type:kirby-plugin
pkg:composer/johannschopplich/kirby-headless
Fund package maintenance!
Requires
- php: >=8.2
- getkirby/composer-installer: ^1
Requires (Dev)
- getkirby/cms: ^5
- getkirby/kql: ^3
- phpunit/phpunit: ^12
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-07 11:33:14 UTC
README
Kirby Headless
Kirby Headless is a plugin for Kirby CMS that adds bearer-authenticated KQL, UUID resolution in blocks and layouts, JSON templates, and an Express-style API builder β keep editing in Kirby and serve the result to whatever frontend you prefer.
Note
Want a ready-to-use headless-only project? Start from the Kirby Headless Starter.
When to Use
| I want to⦠| Use |
|---|---|
| Query content from a frontend over HTTP | KQL endpoint at /api/kql |
| Lock the API behind a token instead of basic auth | kql.auth => 'bearer' + headless.token |
| Resolve UUIDs in blocks and layouts to real objects | $field->toResolvedBlocks() |
| Resolve permalinks in writer and text fields | $field->resolvePermalinks() |
| Return JSON straight from a template | JSON templates / __template__ endpoint |
| Compose custom, authenticated API routes | Api::createHandler() + middlewares |
| Build navigation and language switchers in the frontend | page methods (frontendUrl(), i18nMeta(), β¦) |
Features
- π Bearer Token Authentication: Protect
/api/kqland your own API routes with a bearer token, or fall back to Kirby's native API authentication β see authentication. - π§± Block & Layout Resolution: UUIDs in blocks and layouts resolved to file and page objects server-side, with configurable fields and custom resolvers β see field methods.
- β‘οΈ Enhanced KQL: A drop-in
/api/kqlendpoint with bearer authentication, response caching, and multi-language support via a request header; needsgetkirby/kqlinstalled β see KQL. - π JSON Templates: Return JSON from templates instead of HTML, with built-in
__template__and__sitemap__endpoints, or serve every page as JSON through one catch-all route β see JSON templates. - π’ API Builder: Compose routes from middleware chains, Express-style, and reuse bearer auth, file and page resolution, or your own validators β see API builder.
- π§ Page Methods: Frontend URLs, breadcrumb data, and multi-language metadata for navigation and language switchers β see page methods.
Requirements
- Kirby 5
Note
Using Kirby 4? Install the v4 release.
Installation
Composer (Recommended)
composer require johannschopplich/kirby-headless
Manual Installation
Download and copy this repository to /site/plugins/kirby-headless.
Documentation
For installation, configuration, and usage, see the Kirby Headless documentation.
License
MIT License Β© 2022-PRESENT Johann Schopplich