BLOG

What is Symfony2 and do Drupal Devs need to know something about it?

Symfony2 is a web application framework written in PHP. So what you ask as a Drupal developer, right? Well, you will hear about Symfony2 at some point because Drupal 8 core already includes two Symfony2 components and maybe there is more to come. This post tries to give a quick answer what is Symfony2 and why you should check it out.

Before reading any further I need to warn you about something: I have no predecing experience about PHP frameworks! However I come from Java background so been working with IceFaces framework and made my master thesis about Seam framework. And now about five days of Symfony2. So if I mix some terms up or miss some important aspect, please let me know.

This here? Ok, lets continue...

First we need to clear out a little bit what exactly "high performance next generation full stack web PHP Framework" stands for. I will keep this
short for now:

  • High Performance: Marketing term? Means it is fast. In this case three times faster than Zend.
  • Next Generation: An effort of making a better web user experience. Includes concepts like Web 2.0, XHTML, RIA etc.
  • Full stack: Support from database to front end and everything between. 
  • Web: Specialized for web development.
  • PHP: "Written in PHP." Libraries are PHP, you will write PHP.
  • Framework: See next paragraph.


There is no simple definition for what is a "Framework" but the simple principle why frameworks exists (and are predicted to be the future of  software industry) is that they try to make the software production process more easy and efficient by the principle of "don't reinvent the wheel" and RAD (Rapid Application Development). Framework is the clue that appends together needed (or supported) technologies by the framework without need to building the integration. There are a lot characteristics that frameworks can offer (because we usually need the same stuff for same problem). Next I will list a few concepts about framewors and mirror these to Symfony2:
 

  1. Promise for fast project initilizing, mastery and flexibility. Building Symfony2's developing environment takes about 20min. It comes with an example project skeleton where one can continue. We can include and remove components and 3rd party libraries to use our favourites. Directory structure is flexible and designed to be managetable for large projects. One should also be able remove one technology to another easily but sometimes is only a promise.
  2. Approved methods, architecture and philosophies of doing things. Symphony2 is based on Separation of concerns philosophy and is a modular and extensible core like Drupal. Architecture is the todays favourite Model-View-Controller. It is also applying the service container (or dependency injection) principle which is popular in Java world.
  3. Tools and scripts. Symfony2 has a plugin for Netbeans and Eclipse but (for now) for Netbeans it lacks support for used technologies like Twig template engine and CLI. It ships with profiler and ready to use debug tool.
  4. Standalone libraries and possibilities to expand for mostly used tasks like templates (Symfony2 ships with Twig), mailing (ships with Swiftmailer), cache system and a lot more.
  5. Support for 3rd party technologies. Supporting full stack Symfony2 offers to choose between all major databases, it integrates with PHPUnit testing and other known technologies.

There is also a lot of alternative stuff like caches, context handlers, support for internationalization... (We could even discuss about is Drupal a framework or not? It is not because it is a CMS and a product - which has a lot of charasteristics of a  framework. :) And the aim is to keep it that way, even if there is been discussion about it in Drupal community.)

Maybe the most important thing here still is to understand that it is still PHP you are writing. The other thing to notice at this point is that because the next Drupal core is including elements from Symfony2 and both are modular systems writing extensions/modules to Drupal becomes easier. And because we are dealing here with a extensible framework there are not much limits.  

So if you are a Drupal module developer then you should check out what this project has to offer. Or you could even go and listen about this subject in Drupalcon.

Maybe next time I could write something more practical and technical about Symfony2 when the Drupal 8 project matures and I learn some PHP. :)

Add comment

The content of this field is kept private and will not be shown publicly.
By submitting this form, you accept the Mollom privacy policy.