Header image

Symfony Finland
Random things on PHP, Symfony and web development

Symfony and Content Management: Comparing Bolt, Drupal 8 and eZ Platform

If you're working in the PHP content management space (a fancy way of saying building websites with WordPress, Drupal, etc.) you've likely heard about Symfony. While it is just one part of a larger renaissance in the PHP community, it's probably the best known brand known to developers and business folk alike.

Using Symfony as a concept, however is quite ambiguous. Let's take a look at how three different content management tools have done just this.

For the longest time people working with PHP have been wasting time on duplicate efforts. With the developments in PHP over the recent years it has become easier to share code and concepts across tools. Common configuration conventions, packet management and templating make it easier than ever to hop across tools.

There is still plenty of overlapping fundamental functionality being built in content management systems; Creating and maintaining near identical DB schemas and abstraction for storing content instead of deploying a content repository. But this is a whole other story, so let's not go there today.

Like in any industry, in the CMS space there's lots of vested interest in specific products. People organise "HammerCamps" where they give presentations on how to make everything look like a nail. At the afterparty they compare marketshare penises and pat each other on the back for choosing "the best product". It's easy to get caught in a bubble in these communities.

It's also somewhat hard for outsiders to get an objective view on products that have virtually identical capabilities - add the term of "using Symfony" to the mix and the unintiated are truly confused.

So what exactly is Symfony?

Symfony is essentially a collection of reusable components that perform a very specific task - the HTTPKernel component handles HTTP Requests and Responses, the routing component handles the mapping of URLs to specific functionalities in your applications, the Yaml component parses YAML configurations and converts them to PHP arrays to use in your application. And so-forth. These shared conventions will also come useful in migrating from one CMS to another.

In addition to being a collection of components, the Symfony community also builds and maintains Silex (microframework) and Symfony2 Framework (a complete web framework forcing a structure). Both use individual components from the main project.

Please note that while the Symfony2 framework is slated as a HMVC framework, it does not enforce any Model layer. Doctrine and Propel are the most common ones used, but they are separate projects - not a part of Symfony.

What follows is a quick look at how three different content management systems have decided to take these into use:

  • Bolt CMS - Building a new system from scratch with Silex
  • Drupal 8 - Introducing PHP modern components into a legacy application
  • eZ Platform - Refactoring a legacy application to the Symfony Full Stack Framework

Bolt CMS - built from scratch on top of Silex

Bolt CMS is built from the beginning on the on the Silex microframework. Silex is a lightweight web framework built with Symfony Components and inspired by Sinatra of Ruby fame. The framework does not enforce specific conventions for you, but gives you a quick way to get started with small applications.

While it's a microframework, it can be extended gracefully with common functionalities such as Twig templating, database connectivity and translation services, for example. For structure recommend starting with Silex Skeleton.

When you work with Bolt, you're working with an application built with Silex.

Read more from the Bolt developer documentation and Silex developer documentation

Drupal 8 - Introducing modern PHP components into a legacy application

Drupal is a very common tool for constructing not only websites, but full-blown web applications as well. It has grown from a personal tool to what it is today by copying features such as flexible content model and multilingual support from more advanced content management tools.

The Drupal team decided to embrace Symfony in 2012. In their case they've left a lot of the old code and conventions in place, but have replaced individual pieces with Symfony (and other) PHP components. These are not any vanity components, but core functionalities of a web application such as (chained) routing, HTTPKernel and Twig templating.

With Drupal 8 you're working with a custom structure enforced by Drupal, but you see a lot of familiar concepts and syntax from other projects utilizing Symfony. After years of development, Drupal 8 will likely be released in 2015.

Read more about the new internals on the Drupal 8 developer info page

eZ Platform - Refactoring a legacy application to the Symfony Full Stack Framework

eZ Platform (née eZ Publish) is a full featured content management system. The choice eZ Systems made in 2012 for moving the product forward was a complete transition to the Full Stack Symfony2 framework while maintaining backwards compatibility with a legacy fallback layer.

The full stack approach allows eZ Platform to utilise complete features built for the framework. Many of the routine tasks such as image generation, cache and file handling have been assigned to implementations from the Symfony2 community. User sessions and access control are also integrated to the framework.

With eZ Publish you're working with a Symfony2 application that offers you an internal API for content management. Powerful utilities such as string translations and dynamic routing are at your disposal.

Read more form the eZ Platform Documentation and the Symfony2 Framework Documentation


The co-founder of the hugely popular WordPress project was lately asked about using pieces of Symfony in their product: http://wordpress.tv/2015/07/04/matt-mullenweg-keynote-qanda-wordcamp-europe-2015/ (hop to 15:30). So far they've decided not to adopt Symfony - or other modern PHP conventions.

Taking into account their stance on backwards compatibility I see the point. To my understanding introducing components to PHP code does not create hard-to-dismantle depencency. It would seem that requiring jQuery for your administration interface is a much harder dependency to remove.

Also some have decided to create a delivery layer for Drupal 7 using the Symfony Framework. Read more about this on the Futurice blog: CMS done right, vol. 1


Hopefully you've now got an understanding of a few ways what using Symfony in a CMS could mean.

In addition to these example there are many others such as Concrete5 using Zend and Symfony components and October built with the Laravel Framework (which in turn uses some Symfony components). There are also interesting fresh content management initiatives such as Sulu brewing behind the scenes.

From outside the LAMP realm SiteCore is an interesting example of .NET MVC and CMS interoperation.

One last thing: Using Symfony or other contemporary PHP tooling does not directly affect the experience of the end user. Spaghetti PHP might work just as well, but structure and decoupling will pay off in the long run.

Written by Jani Tarvainen on Thursday July 9, 2015
Permalink - Tags: drupal, bolt, wordpress, php, cms, ezplatform, ez, symfony, silex, mysql

Leave a comment

comments powered by Disqus

« Build a Web Component with Riot.js and Yandex Maps - Test PHP 7 with Vagrant »