In October 2005, the French software company, Sen­si­oLabs published the open source framework, Symfony, which was actually developed under the name Sensio Framework. The unusual spelling of the new name resulted from pre­serving the old class prefix and theme prefix 'sf'. The reason for the framework was Ruby on Rails, which was released a year earlier, and the de­vel­op­ment team’s desire for a com­par­able de­vel­op­ment platform for PHP projects. Since then, Sen­si­oLabs has con­tinu­ously developed the Symfony Framework. For example, in 2011 Symfony 2 added a modular design.

What is Symfony?

Symfony is a col­lec­tion of around 30 PHP libraries that can be down­loaded and used both as a package or in­di­vidu­ally. Apart from these standard com­pon­ents, there are ad­di­tion­al modules that can be used to extend the framework or used sep­ar­ately. According to Sen­si­oLabs, more than 500 million downloads of in­di­vidu­al packages and complete frame­works have been recorded over the past ten years, which is reflected in the general dis­tri­bu­tion: numerous projects such as the Drupal Content Man­age­ment system, the web analysis tool, Piwik and forum software phpBB rely on Symfony com­pon­ents. All packages from this framework are reusable and available for free download on the official website.

Symfony: In­tro­duc­tion to the com­pon­ents of web frame­works

The fact that Symfony can be used as a de­vel­op­ment basis for web projects of all kinds is due to its modular structure. Each module has its own function, but does not rely on other com­pon­ents, which then gives the framework a high degree of flex­ib­il­ity and ex­pand­ab­il­ity. You can use Symfony as a full-stack framework if you need a very broad range of functions for your web project. In addition, you can create your own Symfony library set or create a slim version of the framework. In this way, you can tailor the com­pon­ents to the precise re­quire­ments of your web ap­plic­a­tion – whether it is a complex en­ter­prise project or a simple website. At the same time, you always have the option to add or remove modules as the framework con­di­tions change.

You can choose from the following standard com­pon­ents:

  • Asset: module for URL gen­er­a­tion and image file ver­sion­ing, CSS stylesheets, and JavaS­cript ap­plic­a­tions.
  • Class­Load­er: Class­Load­er ensures that your own PHP classes are loaded auto­mat­ic­ally.
  • Debug: provides tools for debugging PHP code in order to locate and classify errors.
  • De­pend­ency­In­jec­tion: enables you to define standards for creating objects for the re­spect­ive web project.
  • Event­Dis­patch­er: ele­ment­ary component that controls the com­mu­nic­a­tion of in­di­vidu­al modules in the form of events.
  • Form: contains tools that you can easily use to create reusable HTML forms.
  • Tem­plat­ing: tools for creating a template system.
  • Trans­la­tion: module for in­ter­n­al­ising the project.
  • Validator: enables you to validate created classes.
  • Yaml: loads and saves .yml files.
Tip

Did you know that Symfony and Laravel are amongst the most popular PHP frame­works? We show what makes them so good.

Model View Con­trol­ler concept for struc­tur­ing web ap­plic­a­tions

Symfony enables the im­ple­ment­a­tion of the Model View Con­trol­ler approach (MVC). This ar­chi­tec­ture pattern divides ap­plic­a­tions into three areas

  • Data and core func­tion­al­ity (model),
  • Visual present­a­tion of generated data (view)
  • Processing user inputs (con­trol­ler).

The MVC concept provides a clear, well-struc­tured program code and a high degree of flex­ib­il­ity for different com­pon­ents, which can be exchanged and reused depending on the concept, since they are not tied to concrete input data. At this point, however, it needs to be said that Symfony does not belong to the pro­claimed line up of MVC frame­works and does not contain an in­teg­rated model component. If you create a new Symfony project, the typical model folder will also be lacking. Using ad­di­tion­al ORM (Object Re­la­tion­al Mapper) libraries, such as the Doctrine, re­com­men­ded by Sen­si­oLabs, or Propel, you can implement object storage in database systems yourself. To create the present­a­tion layer (view) of your web ap­plic­a­tion, use the template module and create cor­res­pond­ing templates, which can be expanded using the so-called helper (PHP objects) and specific functions. The con­trol­ler level is named index.php (can be found in the 'web' folder). The user inputs are named 'actions' in Symfony, just like they are in many other frame­works as well.

Symfony: PHP as a user magnet

Symfony is a col­lec­tion of various PHP libraries, which is why you must have the script language installed in order to use the framework. For the current supported version of the 2.x series Symfony 2.8, you need PHP 5.3.9 or higher. Symfony 3.1 and 3.2 require PHP 5.5.9 or higher. From the beginning, the Sen­si­oLan­ds developer teams had the goal of creating a component col­lec­tion for PHP projects that could compete with com­par­able frame­works in other languages. In par­tic­u­lar, Ruby on Rails impressed the French de­velopers, which is why they decided to make the in­di­vidu­al com­pon­ents similar to the structure of the popular Ruby framework. The de­vel­op­ment and success of the Symfony Framework is therefore closely tied to the history of the script language. Since this is freely available as an open source language and has always been popular, various de­velopers have optimised it in recent years. The strong per­form­ance increase linked to PHP7 also has a positive impact on the per­form­ance of future Symfony web ap­plic­a­tions.

Downward com­pat­ib­il­ity and LTS versions promise con­tinu­ity

A new version of Symfony has been released every six months since 2013. Users who have re­gistered with the Sen­si­oLab­sConnect community are kept up-to-date with e-mails. Upgrading the framework every six months to a higher version initially sounds like a very tedious and im­prac­tic­al task for complex web ap­plic­a­tions. Sen­si­oLabs, however, provides the right solutions so that the framework and the developed ap­plic­a­tions have the necessary con­tinu­ity:

  • Backward com­pat­ib­il­ity: all Symfony updates (since version 2.3) have been char­ac­ter­ised by backward com­pat­ib­il­ity. This means that the developed ap­plic­a­tions are guar­an­teed to still function when switching to higher versions. However, there are some ex­cep­tions for which the un­res­tric­ted Com­pat­ib­il­ity Promise doesn’t apply. In addition, major releases such as Symfony 3.0 (4.0, etc.) are excluded from the warranty.
  • Long-term support: Symfony versions are usually supported for eight months. With the 2.3 version, Sen­si­oLabs released the first edition of Symfony with long-term support (LTS). These LTS versions are planned for every two years and provide 36 months of updates for program errors and 48 months of security patches. In addition to the scheduled second LTS version 2.7, the following version 2.8 was also equipped with the extended support period.
  • 'Con­tinu­ous Migration Process' for 3.0: when switching over to the last major version, Symfony 3.0, the de­vel­op­ment team ac­com­pan­ies you while using the Con­tinu­ous Upgrade Path concept. As a Symfony ap­plic­a­tion developer, you can receive detailed tips for revising lines of code in 2.x versions, gradually adapting them to the new spe­cific­a­tions. You can then upgrade to the new version of the web ap­plic­a­tion framework.

The ad­vant­ages and dis­ad­vant­ages of the Symfony Framework

Searching for the ap­pro­pri­ate PHP framework in the past was like looking for a needle in a haystack: the desire for a powerful library set for the popular web language led to the de­vel­op­ment of numerous rep­res­ent­at­ives, which were quite different for different project types. However, a few frame­works – including Symfony – have managed to impress a large number of PHP de­velopers, thanks to its con­tinu­ous progress. The framework scores es­pe­cially well when it comes to struc­tur­ing and linking in­di­vidu­al modules, which can be used to implement various web ap­plic­a­tions, con­trib­ut­ing to it being highly rated by the community. With long-term support versions and the general promise of providing the highest possible level of backward com­pat­ib­il­ity, the Sen­si­oLabs de­vel­op­ment team also provides the right found­a­tion to ensure that the Symfony project can continue.

Nev­er­the­less changing to a new version of the framework and the ad­just­ments as­so­ci­ated with the code of the developed Symfony ap­plic­a­tion is sometimes a rather tedious matter. And that is despite the fact that as­sist­ance is offered. Com­plex­ity is also generally a big problem of the PHP framework. Although there is plenty of in­form­a­tion and lots of ex­plan­a­tions for each module, beginners could find it difficult to fa­mil­i­ar­ise them­selves with the framework. The Symfony Framework also reveals weak­nesses in per­form­ance – even in com­par­is­on to other PHP frame­works. The use of the resource-intensive ORM library doctrine also plays an important role here.

Who is the PHP component col­lec­tion suitable for?

All Symfony modules are char­ac­ter­ised by the fact that they work in­di­vidu­ally as well as in a network. The latter does not have to be the standard framework bundle: you can also create your own micro-framework, which is compiled only with the com­pon­ents you choose. In this way, you avoid having to work with an over­loaded library structure that goes far beyond the re­quire­ments of the developed project. But Symfony is also scalable in the other direction and can be quickly converted into a basic design for demanding web projects with ad­di­tion­al modules. It’s not only the above-mentioned ap­plic­a­tions (complete or partial) that are based on Symfony, but also the website of the music streaming service, Spotify. The French website of fashion magazine, Vogue, also benefits from using the PHP framework.

The Symfony Framework is the right choice for you if you want to work with PHP and have a high degree of flex­ib­il­ity. In order to use the in­di­vidu­al libraries correctly, however, you need to know more than just the basics of the script language. So plan some time to get to know the features of the framework and then take advantage of all the benefits of de­vel­op­ing with Symfony.

Go to Main Menu