formatz / contao-headless-cms-bundle
Contao Headless CMS Bundle
Package info
gitlab.com/formatz/contao-headless-cms-bundle
Type:contao-bundle
pkg:composer/formatz/contao-headless-cms-bundle
Requires
- php: ^8.4
- contao/core-bundle: ^5.3
- contao/news-bundle: ^5.3
- psr/log: ^2.0 || ^3.0
- symfony/config: ^6.4 || ^7.0
- symfony/dependency-injection: ^6.4 || ^7.0
- symfony/http-client: ^6.4 || ^7.0
- symfony/http-foundation: ^6.4 || ^7.0
- symfony/http-kernel: ^6.4 || ^7.0
- symfony/routing: ^6.4 || ^7.0
- symfony/serializer: ^6.4 || ^7.0
- symfony/translation-contracts: ^3.0
Requires (Dev)
- contao/manager-plugin: ^2.0
- phpunit/phpunit: ^11.5
Suggests
None
Provides
None
Conflicts
- contao/manager-plugin: <2.0 || >=3.0
Replaces
None
README
Requirements
- PHP 8.4 or newer
- An up-and-running Contao 5.3 (LTS) or newer installation, with the news bundle
Installation
Install composer if you haven't already, enter this command in the main directory of your Contao installation:
composer require formatz/contao-headless-cms-bundle
Contao Content API is now installed and ready to use.
Usage
Once installed, the following routes are available:
/api/page?url=/about/team.html OR /api/page?id=5
Gets the page, including all articles and contents at the url or id.
Example | Example with newslist | Example with newsreader
/api/module?id=5
Gets the content of a module by id
/api/content?id=5
Gets the content of a content element by id
All routes also take the additional lang parameter (e.g. ?lang=de). If you
need to override the language.
Clear the cache of the headless application
When a page, an article, a content element, a news, a form, a FAQ or an event is
saved in the back end, a POST request is sent to the headless application(s):
APP_CLEAR_CACHE_URL=https://app1.example.com/api/clear-cache,https://app2.example.com/api/clear-cache
APP_CLEAR_CACHE_KEY=secret
The token is sent in the X-Authentication-Token header, the body contains
name=cmsCache_event and the id of the record. Several endpoints can be
separated by commas. Errors are logged but never block the back end.
Development
composer install
vendor/bin/phpunit
Contribution
Bug reports and pull requests are very welcome :)
© Format-Z 2026