Why Symfony? Seven Facts

Posted on by Matthias Noback

A couple of days ago I was asked to explain myself: "Why Symfony?". I was reminded of this video - an interview with Fabien Potencier:

Fabien mentions some facts about Symfony that are key to understanding it, as an outsider. These same facts (and some more) will also help you to "sell" Symfony to others.

First of all, Symfony is a set of building blocks. You can pick the ones you need for the specific web application you are going to develop. Will the application be having some kind of secured area, where only members can log in to? You'll need the Security Component. Does your application have forms? Install the Form Component. Is it going to be a full-fledged, interactive, web application with some console commands? Install all components, and the "glue" between them: the Symfony Standard Edition.

Second, out-of-the-box, Symfony does nothing. Of course, there is a nice welcome page and some demo pages that you'll see once you have installed the Symfony Standard Edition. But really, there is no interface, there is no "admin" panel. There is just empty space, ready to be filled by your application's code.

Third, using Symfony you won't have to "reinvent the wheel" for each project. Symfony provides tools for many things you want to do in every project: render pages using templates, validate the values of submitted forms, secure part of the application with a login form, etc. Symfony has made many decisions for you on each of these low-level subjects.

Fourth, you can still make your own decisions when it comes to (almost) anything. You may agree with Symfony's "sensible defaults", but even when you don't: nothing stops you from doing things differently. In fact, Symfony encourages this and enables you to do so. Almost every part of the framework can be replaced by your own implementation. The key to this flexibility is the dependency inversion principle, which is practiced everywhere in Symfony's codebase.

Fifth, if you have become acquainted with Symfony and its components, it will be much easier to get involved with another project which uses some or all of the Symfony components. It will also be much easier to share code between projects.

Sixth, when it comes to reusable code: there is a lot of it. The Symfony community is big enough to have something for any need you may have. Even though the quality of reusable packages varies a lot, there are always some shoulders of giants you can stand on. And when you have developed something that nobody has done so well before, it is very easy to share it, on GitHub and Packagist, using Composer.

Seventh, by working with the Symfony components, writing extension or replacement code, and by preparing your classes for dependency injection, your code quality will automatically increase. I know that I have become a better developer since I started using Symfony2, and I have seen many other developers display the same growth in technical ability.

In conclusion: lots of good things to say about Symfony. I hope that when you are still in doubt, you will soon give it a try.

If you are already developing Symfony applications, and are looking for some more advanced information and best practices, especially about writing reusable code, check out my book A Year With Symfony.

PHP Symfony2 reuse
Comments
This website uses MailComments: you can send your comments to this post by email. Read more about MailComments, including suggestions for writing your comments (in HTML or Markdown).
ZoRDoK

Seven facts about all frameworks, nothing more.

Matthias Noback

Agreed, I was kind of waiting for this reply :). Still there are great differences between frameworks and really, they teach you different best practices which may or may not be best practices in general. Maybe that's my most important point here ("fact" 7).

Ricard Clau

Nice list, I could not agree more!

However, I think there is an eighth important fact that you've missed in the list: clear LTS versions release policy.

This is a key factor for companies deciding between one open-source project or another. In 2016 there will still be someone fixing bugs and maintaining Symfony2.3

Patrick

You named the pro's of using a framework but not why specifically Symphony.
There are more frameworks around besides Symphony.
I do like Symphony but use an other framework ( Yii )

Matthias Noback

By the way (somewhat related to this) - the title of one of my next posts will: "Why you should not develop Symfony bundles". What bothers me exceptionally is the fact that many things are being created again and again, just for some specific framework.

Matthias Noback

Haha, agreed - you caught me there!

I think flexibility is one of the most important advantages of Symfony (with an f ;)) over other frameworks that I've seen. Changing parts of the behavior of Symfony itself is really easy in most situations. Also, the way you can take one Symfony component and use it stand-alone is really great, though I know that there are other frameworks trying to do this.

cordoval

Can't agree more. And remember also symfony2 is not just a framework, is glue to its community which has projects sprouting out like silex, yolo, vespolina, sylius, etc, and are rediscovering different and better ways to do things!