Header image

Symfony Finland
Random things on PHP, Symfony and web development

A GraphQL Bundle adds protocol support to eZ Platform Symfony CMS

GraphQL is a technology that allows developers to make queries (and mutations) against an external interface in a structured way. It is similar to REST APIs, but as a more complete specification it is universal and allows true decoupling from a CMS, rather than building on a specific REST implementation of a system.

The technology originates from Facebook and together with React has quite a bit of momentum currently. In a recent experiment Bertrand Dunogier from the eZ Systems engineering team in Lyon created an extension to the Open Source eZ Platform Symfony CMS that allows developers access the content repository in an alternative way to the available REST API.

Building on existing work from the Overblog and Webonyx teams, the eZ Platform GraphQL Bundle enables developers to query the content repository provided by eZ Platform using the exact same protocol and methods as a number of other tools, including GraphQL enabled client libraries like Apollo.

With a PHP port of the GraphQL JavaScript reference implementation and a Symfony integration layer on top, the eZ Platform GraphQL Bundle simply adds an integration layer to the Open Source CMS. This enabled a single developer to achieve impressive results in a matter of days, which is largely thanks to being able to leverage previous efforts using Composer and Symfony.

The source code of the GraphQL Bundle is currently available on Github and one can install it, but as a quick test there is also an online demo available on Platform.sh. With this demo you can test how queries behave using the Graphiql, an in-browser IDE for exploring GraphQL.

The demo installation is not guaranteed to be available for long term, so below is a screencast demostrating how the GraphQL API maps to the eZ Platform content repository structure:

All in all this is a perfect example of how Symfony and the broader PHP ecosystem allow accelerated development and experimentation on new features without rewriting core functionalities from scratch.

Learn more

Written by Jani Tarvainen on Tuesday October 11, 2016
Permalink -

Leave a comment

comments powered by Disqus

« Using CQRS/ES for Content Management Systems (CMS) - What's in store for PHP performance? »