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 reusability