In October 2005, the French software company, Sen­si­o­Labs 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­serv­ing 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­pa­ra­ble de­vel­op­ment platform for PHP projects. Since then, Sen­si­o­Labs has con­tin­u­ous­ly 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­vid­u­al­ly. Apart from these standard com­po­nents, there are ad­di­tion­al modules that can be used to extend the framework or used sep­a­rate­ly. According to Sen­si­o­Labs, more than 500 million downloads of in­di­vid­ual packages and complete frame­works have been recorded over the past ten years, which is reflected in the general dis­tri­b­u­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­po­nents. All packages from this framework are reusable and available for free download on the official website.

Symfony: In­tro­duc­tion to the com­po­nents 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­po­nents, which then gives the framework a high degree of flex­i­bil­i­ty and ex­pand­abil­i­ty. 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­po­nents to the precise re­quire­ments of your web ap­pli­ca­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­po­nents:

  • Asset: module for URL gen­er­a­tion and image file ver­sion­ing, CSS stylesheets, and JavaScript ap­pli­ca­tions.
  • Class­Loader: Class­Loader ensures that your own PHP classes are loaded au­to­mat­i­cal­ly.
  • Debug: provides tools for debugging PHP code in order to locate and classify errors.
  • De­pen­den­cy­In­jec­tion: enables you to define standards for creating objects for the re­spec­tive web project.
  • Event­Dis­patch­er: el­e­men­tary component that controls the com­mu­ni­ca­tion of in­di­vid­ual 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­nal­iz­ing the project.
  • Validator: enables you to validate created classes.
  • Yaml: loads and saves .yml files.
Tip

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

Model View Con­troller concept for struc­tur­ing web ap­pli­ca­tions

Symfony enables the im­ple­men­ta­tion of the Model View Con­troller approach (MVC). This ar­chi­tec­ture pattern divides ap­pli­ca­tions into three areas

  • Data and core func­tion­al­i­ty (model),
  • Visual pre­sen­ta­tion of generated data (view)
  • Processing user inputs (con­troller).

The MVC concept provides a clear, well-struc­tured program code and a high degree of flex­i­bil­i­ty for different com­po­nents, 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­te­grat­ed 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, rec­om­mend­ed by Sen­si­o­Labs, or Propel, you can implement object storage in database systems yourself. To create the pre­sen­ta­tion layer (view) of your web ap­pli­ca­tion, use the template module and create cor­re­spond­ing templates, which can be expanded using the so-called helper (PHP objects) and specific functions. The con­troller 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­oLands developer teams had the goal of creating a component col­lec­tion for PHP projects that could compete with com­pa­ra­ble frame­works in other languages. In par­tic­u­lar, Ruby on Rails impressed the French de­vel­op­ers, which is why they decided to make the in­di­vid­ual com­po­nents 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­vel­op­ers have optimized it in recent years. The strong per­for­mance increase linked to PHP7 also has a positive impact on the per­for­mance of future Symfony web ap­pli­ca­tions.

Downward com­pat­i­bil­i­ty and LTS versions promise con­ti­nu­ity

A new version of Symfony has been released every six months since 2013. Users who have reg­is­tered with the Sen­si­o­Lab­sCon­nect 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­ti­cal task for complex web ap­pli­ca­tions. Sen­si­o­Labs, however, provides the right solutions so that the framework and the developed ap­pli­ca­tions have the necessary con­ti­nu­ity:

  • Backward com­pat­i­bil­i­ty: all Symfony updates (since version 2.3) have been char­ac­ter­ized by backward com­pat­i­bil­i­ty. This means that the developed ap­pli­ca­tions are guar­an­teed to still function when switching to higher versions. However, there are some ex­cep­tions for which the un­re­strict­ed Com­pat­i­bil­i­ty 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­o­Labs 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­tin­u­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­pa­nies you while using the Con­tin­u­ous Upgrade Path concept. As a Symfony ap­pli­ca­tion developer, you can receive detailed tips for revising lines of code in 2.x versions, gradually adapting them to the new spec­i­fi­ca­tions. You can then upgrade to the new version of the web ap­pli­ca­tion framework.

The ad­van­tages and dis­ad­van­tages 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­re­sen­ta­tives, 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­vel­op­ers, thanks to its con­tin­u­ous progress. The framework scores es­pe­cial­ly well when it comes to struc­tur­ing and linking in­di­vid­ual modules, which can be used to implement various web ap­pli­ca­tions, con­tribut­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­i­bil­i­ty, the Sen­si­o­Labs de­vel­op­ment team also provides the right foun­da­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­at­ed with the code of the developed Symfony ap­pli­ca­tion is sometimes a rather tedious matter. And that is despite the fact that as­sis­tance is offered. Complexity is also generally a big problem of the PHP framework. Although there is plenty of in­for­ma­tion and lots of ex­pla­na­tions for each module, beginners could find it difficult to fa­mil­iar­ize them­selves with the framework. The Symfony Framework also reveals weak­ness­es in per­for­mance – even in com­par­i­son 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­ized by the fact that they work in­di­vid­u­al­ly 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­po­nents 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­pli­ca­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­i­bil­i­ty. In order to use the in­di­vid­ual 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