Headless or Hybrid — The Possibilities are Endless with Sulu

Sulu — the Symfony CMS — delivers all you need for a headless CMS setup or a hybrid approach. Serve your content via API, use the fully-featured rendering engine, or do both.

Out-of-the-box features make Sulu headless-ready

  • Output content in multiple different formats (HTML, XML, JSON, …)
  • Recognize format based on request
  • Clean separation of content and output
  • Extendable using Symfony know-how
  • API provided by SuluHeadlessBundle
  • Serves navigation structure via dedicated REST API endpoint
  • Search endpoint
  • Library makes building a React application easier
  • Rendering engine can easily be swapped out
  • Administration Live Preview also available in headless mode
  • Reuse Sulu authentication for your custom API
  • “Bring your own entity” can be used with your API
  • Routing has already been taken care of
Deliver Sulu content as JSON
Headless and API First Scenarios -Step 1

Plan your content model

Start by determining the fields that a content manager needs to work with, then define them in XML.

Headless and API First Scenarios -Step 2

Build your JSON Twig template

The simplest solution is to use the json_encode filter in Twig to output the unescaped content, which is very easy to understand. This works because the file-name extension — e.g. “.json.twig” for JSON, or “.html.twig” — is automatically appended based on the request.

Headless and API First Scenarios -Step 3

Start managing content

Your content managers have freedom to edit content in a structured manner with a user-friendly interface, and  output can be generated in different formats (HTML, JSON, XML, and more).

Headless and API First Scenarios -Step 4

Access the content with the “.json” suffix to retrieve JSON

Content can be accessed by adding the appropriate suffix to the request. For example, “.json” will return the JSON template (“.json.twig”).

See for yourself

We’d love to show you around Sulu so you can see how businesses benefit from its features and why developers love it. Get in touch and we’ll give you an online tour via video call.

Request Live Demo
Deliver Sulu content with the HeadlessBundle
HeadlessBundle -Step 1

Install the HeadlessBundle

Deliver JSON with the HeadlessBundle when you need more advanced functionality — although it’s one additional dependency you need to handle.

HeadlessBundle -Step 2

Build your XML template with the Headless Controller

The HeadlessBundle will take care of rendering the JSON output for you.

Headless and API First Scenarios -Step 3

Start managing content

Your content managers have freedom to edit content in a structured manner with a user-friendly interface, and output can be generated in different formats (HTML, JSON, XML, and more).

Headless and API First Scenarios -Step 4

Access the content with the “.json” suffix to retrieve JSON

Add the appropriate suffix to access content — ”.json” will return the JSON response.