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.

Headless and API First Scenarios
Why Sulu

Out-of-the-box Features Make Sulu Headless-ready

The API that has you covered.

Enjoy an API that doesn’t fall short of your use cases. While many APIs seem promising at first glance, they often reveal gaps and missing features over time. Sulu’s API includes everything a headless CMS needs.

  • Serves navigation structure via dedicated REST API endpoint
  • Search endpoint
  • “Bring your own entity” can be used with your API

The same data in different clothes.

Retrieve data from Sulu in the format you need. No need for plugging external data converters into the data flow. Sulu can provide data in multiple formats for apps, special displays, web sites, and more.

  • Output content in multiple different formats (HTML, XML, JSON, …)
  • Recognize format based on request

Made to measure.

Focus on business logic instead of implementation details. Doing everything from scratch rarely pays off — 90% of what you need is already available in the base configurations of products like Sulu. Add extra functionality with robust Symfony bundles, either provided by Sulu or created by you. 

  • API provided by SuluHeadlessBundle
  • Library makes building a React application easier
  • Administration Live Preview also available in headless mode
  • Reuse Sulu authentication for your custom API
  • Routing has already been taken care of

Ever seen a butcher baking bread?

Leverage the power of components that do only one thing but do it well. A monolithic system without clearly defined borders is hard to extend and hard to modify. Sulu is made of a lean core and self-contained components that can be mixed and matched as needed. 

  • Clean separation of content and output
  • Extendable using Symfony know-how
  • Rendering engine can easily be swapped out

 

How to

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

computer with a paper plane (1)

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.

How to

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.

Explore more

Other Important Topics

Explore the many ways Sulu powers digital platforms and experiences