Let's talk about the Symfony2 framework

Symfony is a set of PHP Components, a Web Application framework, a Philosophy, and a Community — all working together in harmony.

To begin, Symfony is a PHP web app released in 2005 under MIT license. Dailymotion or Yahoo are amongst the most famous websites to use part or full of their code in Symfony. As a matter of fact, various CMSs have adopted the use of Symfony, making the creators of this platform closer and closer to their ultimate goal of designing a revolutionary open-source platform for creating simplified end-user products. The announcement of a future collaboration between Drupal and Symfony was originally made in 2012 and for a while, nobody seemed to know exactly what this agreement between the giants of the open-source was going to bring new to the whole Drupal experience.

Now with the release of Drupal 8, we get to try it out and to see exactly what all the fuss is about

Symfony2 into Drupal 8

We have noticed a sort of contempt when talking with drupalists about all the improvement that Symfony was going to bring to Drupal. Briefly, this collaboration is a win-win situation. Symfony is a stable framework that helps Drupal being even more stable, secure and easy to use. At the end of the day, you will have a well-balanced system, with part of the Symfony core, yet extended with a flexible CMS layer. What's more, to ask for?

Symfony2 in Drupal 8

Let's analyze the Symfony2 components that are part of the Drupal 8 core to a major extent:

HttpKernel and HttpFoundation – accelerates the process of converting a Request into a Response with EventDispatcher. This makes Drupal 8 a more flexible, robust and easy to maintain CMS.

Translation – yey…finally a set tool to load translation files, generate translated strings as output, and use the generated outcome. For someone with a back in translation studies and CAT, this is the best news since the release of TRADOS…OK, maybe I got a bit carried away, but this means so much for all the development of multilingual websites, that makes all translators and content managers really happy.

Validator – as the name indicates, this tool is a VV – a value validator.

EventDispatcher – this component is really useful when it comes to a huge number of classes, as it makes the transition between classes simple and easy. It implements the Mediator pattern (that uses encapsulation) in a simple and effective manner.

YAML – YAML strings are converted to PHP arrays and the other way around. Part of Drupal’s CMI this component allows defining the default configuration settings and later allows the site builder to override the same as-and-when instructed to.

Twig – the adoption of the Twig template engine is an amazing piece of news for all themers who will find it quite easy to use.

ClassLoader – auto-loading classes. It will come with classical Symfony autoloaders like PSR-0 ClassLoader and MapClassLoader. Implementing module_load_include stops being a problem and makes our life easier.

Routing – mapping an HTTP request to a set of configuration variables has never been so easy.

DependencyInjection – with this component, you may write code with reusable classes. These classes can also be unit-tested wherever needed.

Process – the commands can be executed in sub-processes using the command-line interface.

Serializer – us it to transform objects into and from a specifically needed format (XML, YAML, JSON), but about this feature we will be talking in a future article.

We will come with more info on this theme, asap, but meanwhile, this is us while discovering Drupal 8 :D

This is relevant for …

drupal 8, symfony

Post a comment