The basics of Symfony

Published by Uros
on 31 August 2016

Latest version of Drupal, known as Drupal 8, transformed today's world. Its functions are being explored practically everyday. But not so many people know that Drupal 8 is based on Symfony. This PHP web application framework created many websites and web applications and is used by either small or big corporations, so we present you the basics of it.

But before we get to know Symfony better, we need to answer the most common question. Why should you use framework (at all)? The truth is, framework is not necessary. It is just one of the available tools to help you develop better and faster. Latter, because it allows developers to save time by re-using generic modules and can focus more on the task not on the technology and better, because a framework provides you with the certainty that you are developing a structured, maintanable and upgradable application.

List of components

A framework is not a black box, but is, in the case of Symfony, still a PHP. Components can be used independantly in your own applications and are not limited to 'Symfony universe'. So, if you want to build your own application, you can use any of the components we will present you and use it independently from the Symfony Framework.

Symfony Components


Symfony Components are a set of decoupled and reusable PHP libraries. Symfony is therefore a structure of many components, but we will take a look and explain only some of them. For example, Yaml loads and dumps Yaml files, Browser Kit simulates the behaviour of Web browser, Config helps you validate configuration values, Console eases the creation of beautiful and testable command line interfaces, EventDispacher implements the Mediator pattern in a simple and effective way to make projects truly extensible, Form provides tools to easy creating, processing and reusing HTML forms, Finder finds files and directories via an intuitive fluent interface, Intl provides fallback code to handle cases when the intl extension is missing, Routing maps an HTTP request to a set of configuration variables, Translation provides tools to internationalize your application and so on.

Projects

Symfony is one of the best platforms to build Open-Source projects. In addition to Drupal, which we already mentioned obove, many PHP projects are embedding various components of Sympfony. Joomla, phpBB, Composer, Magento and Laravel, which some treat as sister's web application to Symfony, are some of them. Furthermore, a project like eZ Publish Community even use a full-stack Symfony framework.

 

Drupal 8 and Symfony

 

Why should you choose Symfony?

Since Symfony is just one of the available tools and is not even necessary, you must have pretty good reasons why you should choose it over competition, or in fact, why you should use it at all. Besides reasons similar to the ones discussed above, Symfony's reputation with a number of its well known references tops the list. Symphony is also pragmatic, comfortable, flexible and has a large community support, which make it very accessible. If we, for example compare it with Zend Framework 1.10, we find out that Symfony is three times faster, while also taking up two times less memory.

In case you have decided to try Smfony, keep in mind that a new minor version comes out every six months. The next one, 3.2.0, is planned for November. On the other hand, major versions are released every two years and the new one is expected in 2018.