Symfony PHP Framework – My first 10 months

This is a narrative of my experience with the Symfony PHP 5 framework over the last 10 months. The short story is that I’m a fan, but it’s not perfect.

An Overview of my experience with Symfony

So I started learning Symfony about 10 months ago (November 2006), and I feel I can finally offer an informed opinion on the framework. Unfortunately Symfony is the only framework I’m familiar with, and oddly enough PHP is my primary programming language. So I don’t have anything to compare Symfony to.

I started learning the Symfony PHP framework after I was hired on at MoCo. The senior Web Developer there had chosen Symfony and was not interested in discussing any alternatives. At the time Symfony was still in beta, and the documentation actually fairly good for this early stage. I ended up doing much of the front end View layer work for www.Sanus.com. Mostly because I was the only one, at the time, who had a good grasp of CSS. Later I moved on to having a better understanding of the Model layer and I’ve created, edited, & queried databases many times using the integrated Propel Database Abstraction Layer. Something that I wish I was more involved in on the Sanus.com project was the i18n (internationalization) support, we were able to cram around 8 different languages into 1 CSS layout. FYI, Russian uses the Cyrillic alphabet and it is both very long and will break many of PHP string functions, like ucfirst().

More recently at MoCo we’ve been working on what is probably the best real estate site in the Upper Midwest (Minnesota, Wisconsin, Iowa, & the Dakotas) Webdigs.com. With Webdigs.com I’ve spent much of my time working with the database layer, form validation, and building admin interfaces. The most productive thing I’ve done is build a pretty decent little Content Management System out of a highly modified admin Interface that Symfony & Propel pretty much created for me. This has freed me from having to deal with the 90+ pages of static content that’s been added to Webdigs.com so far.

Learning Curve

Getting started with Symfony can be brutal. Just getting it installed correctly takes a pretty decent understanding of Systems Administration, I still have not got it working correctly in windows, luckily I use a Subversion checkout on our development server. The first project is, of course, the most difficult afterwards things get MUCH easier. I have noticed from a couple excellent additions to our team that Developers with some Ruby on Rails experience have picked up Symfony fairly easily, while the folks who have never used a framework tend to struggle with it longer. I believe that it’s a mix of much of Symfony being based off Ruby on Rails & learning Ruby on Rails demonstrates both an intellectual curiosity & a passion for Web Development.

There are some excellent resources for learning Symfony. SitePoint.com has a good & current tutorial on Symfony titled: Learn Symfony: a Beginner’s Tutorial. PHP | architect also had 2 issues (April & May of 2007 ) in a row with good articles that provide an introduction to the Symfony Framework. There is also a printed book that I highly suggest purchasing and reading, however the book is also available online for free. Finally the Symfony website: www.symfony-project.com is a great resource. A semi hidden gem is the Symfony API, it is hard to navigate, and the information is not perfect, but still very useful. The Symfony homepage also has some good tutorials, the best being the Askeet 24 days with Symfony tutorial. There is also a tutorial that I’ve had varying degrees of success with. What I have found very helpful is reading the Symfony source, it’s well written and fairly well commented. Another resource turns out to be my company’s direct competitor in the Twin Cities, spindrop.us which seems to be the domain of Dave Dash, who has contributed to several of Symfony’s plugins.

The Good

The best thing about Symfony is that it lets me get things done faster. I can create new functionality faster, because much of the drudgery has been largely removed from the equation. I can maintain / update things faster because many things are standardized. The gentle enforcement of the MVC (Model / Controller / View) layers just makes sense after a while, and lends itself to reusable code. I really like the Javascript / Ajax helpers, they have made me look like I’m much better at Javascript than I probably am. The compartmentalization of the View layer (the part that deals with what you see) has allowed our team to have a more productive integration the Web Designers. The ease of creating & customizing easy to use backend administration pages have allowed our technical writers to directly add & edit content on the website. This has allowed us to cut out some pretty big steps from our process, & simplify communication. Symfony has allowed me to focus on more interesting tasks because of these efficiencies.

Another great thing about Symfony are the plugins that can be installed and add functionality without a huge amount of time. The one I use the most is sfGuard, which us a user management plugin.

The Bad

It is not all a bed of roses.

Without someone around who is willing to hold your hand a little, learning Symfony can be a daunting task. It’s not so very difficult, and it gets easier every day with the additions to the knowledge base.

The way the databases are created, and modified can be maddening. There does not appear to be a way to modify a single table and only rebuild the model layer function for it, the entire database must be dumped and rebuild. To make matters worse the database backup system is broken and reloads data unreliably, again as far as I can tell. I work around this by doing a MySQL complete data dump, and reloading it when I’ve rebuild the database structure.

The documentation is not perfect, documentation never seems to be. It is generally better than Microsoft documentation, but not as good as the PHP manual.

I once spent a couple hours combing through the documentation to find a solution to finally find a forum post that included a post by one of the Symfony developers only to find that he was telling the forum poster to read documentation, that turned out to be so outdated as to be difficult to adapt.

Symfony does not have the same popularity level as Ruby on Rails. In the Twin Cities of Minneapolis & St. Paul Minnesota there are only 2 shops that I know of that use Symfony, luckily the other place does not appear to have the same quality of designers that MoCo has. 😉

Some of the plugins really aren’t much, have very little documentation, and need a lot of work, but hey I didn’t have to pay for them either.

Conclusion

I believe the good vastly outweighs the bad, and since last November things have continued to improve. I’m really looking forward to the 1.1 release, and further development in some really promising plugins, like the CMS plugin.

However I do hope to spend some time to look at the options that are out there. I have not spent much time looking into the Zend framework or Ruby on Rails.

The only changes to Symfony that I would make would be to package up a solution that is ready to for most of a brochure type site, and ready to be modified for more advanced features. I’d roll in the user management, a CMS, a Menuing system, and some basic frameworks and templates, and maybe a lot of what is in the Blueprint CSS framework.

I’d also make it easier to make granular changes to databases after the Model layer has been built.

Symfony is a great framework, it makes me a better more productive Web Developer and I believe it is worth consideration if you are looking for a new framework.