About two years ago I was looking through the various web development job listings and started noticing this thing called Ruby on Rails in the requirements of various job descriptions. Upon further research I discovered that it was this wonderful godsend thing called a Web Development Framework. Before that point in my years of web development in PHP, I had fallen into the bad habit of developing sites with intermingling PHP code and HTML and code scattered everywhere. With every project, I got a better sense of how to organize my code so that it would be easier to manage and rapidly develop websites/applications, but it still was a pain in the a** 90% of the time.
So when I discovered the idea of web application frameworks I was instantly ecstatic. Ruby on Rails seemed like exactly what I need….except damn I don’t know anything about Ruby! At that point I still went ahead and installed it and went through the various online tutorials and even bought a book about it. Finally I came to the conclusion that I didn’t want to go through the process of learning another language just for web development. Sure, once you know one language it is relatively easy to apply the basics to learning a new one, but honestly I didn’t want to take the time.
Soon I began learning the basic principals of MVC frameworks and trying to figure out how to build my own in PHP. Using the concepts I learned in this series of tutorials and converting some of my own home-brewed classes I built my own MVC framework for PHP. Around the same period I had initially discovered CakePHP and played around with it, but I was determined to build my own. Eventually I dropped the idea of using my personal framework and made the switch to Cake.
At first I was hooked on Cake and began using it for all my new projects at the time. I thought that it was exactly what I needed and couldn’t imagine anything better. However soon I started noticing that some things that seemed like they should be easy turned into big hassles when using the framework. Eventually I soon started programming in strictly object-oriented PHP5 and grew tired of Cake’s PHP4 way of doing things.
So some time later, I needed to decide on a PHP5 framework for my team to use at work. For awhile I was set on using the Zend Framework and didn’t really consider any other options. When I did start finally start learning how to set up and use Zend, I was slightly frustrated. At that time I felt that it was pretty hard to find good documentation or tutorials that set a standard way for it to be configured. I now realize that an advantage of the framework is that you can set it up however you want. But I wanted something similar to Cake where I could instantly configure some basic settings and then be able to do some prototyping and have something going right away. That wasn’t gonna happen with Zend.
So now I went back to researching PHP 5 frameworks and stumbled across symfony. Once I started reading the online docs and the capabilities I was instantly hooked! I installed it and started experimenting. Nice! The next day I went to Borders and bought the excellent book “The Definitive Guide to symfony”. Soon I was cooking up applications faster than smoking a cigarette. For me this framework had everything that I was desperately needing in the other frameworks I had used. Also, the online community is top-notch. That combined with the book/online documentation it is fairly easy to solve any common problems that I may come across.
I have seen some mentioning of symfony being confusing and having a steep learning curve compared to other frameworks. Initially it took me longer than expected to get it working on a specific development server because of some missing requirement and unusual configurations within Linux. But in the end it only took a couple of days to iron that out and have a working project. Once it was working it was fairly easy to get a large understanding of how everything works. For me purchasing the book and just reading it without being in front of the computer definitely helped.
Here are some things that I think are highlights of the symfony framework:
1. Easy Database Abstraction
By default symfony uses Propel for it’s database abstraction. At first it may be slightly confusing getting used to the idea of creating a schema.yml file to describe your database structure and to understanding the format in which you make your queries using Propel. But after getting used to it, I found that the structure of everything is very logical. Of course there is the slight issue that the current version of Propel bundled in symfony (1.2) is not as fast as other kids on the block. So far I have managed to plan things out carefully and make sure that everything else is optimized, so it hasn’t been a huge drawback yet. There is the option of using the Doctrine plugin as a replacement for Propel which seems like a really good alternative. Personally I haven’t wanted to let Propel go, so I haven’t made that switch yet.
2. Development Tools
Symfony includes a wide variety of useful command line tools to help with development and project management. You will end up using these tools to do things such as automatically generating your Propel model classes, scaffolding, clear cache, etc. The built in rsync feature is especially useful for pushing your code to production servers.
Just type:
> symfony sync production go
and your project is automatically synced up in your production environment.
Another useful feature in symfony is the Web Debug Toolbar. When you have this feature activated, each page in your project has a nifty little toolbar in the upper-right hand corner of the screen. This toolbar gives you lots of information about the queries that were run, a breakdown of the time it took to run certain things, and log details for that action.
3. Caching Features
The framework has extensive caching features built in. It is easy to configure view caching so that whole pages or fragments are cached. It is also very easy to extend the base cache classes so that you can whip up your own custom caching for data, such as caching to files, SQLite, and memcached.
4. Plugins, Plugins, Plugins
The symfony plugin page is full of useful tidbits that members of the community have contributed. 90% of the time I am able to find a plugin that implements a specific feature that I may need. If not, I can find something close and customize it to my needs. If nothing exists yet, then it is easy to create a plugin that encompasses some feature that I know I will end up easily using again for future projects.
5. Ease of Configuration
symfony has a very granular configuration system which makes it very convenient to create settings for specific areas of your project. You can set up configuration variables in the yml files in the application, module, or action level.
All in all I think that symfony is much more advanced than many of the other PHP frameworks that are out there. Everything that I previously wished that others such as Zend and Cake had pretty much are present in symfony. I encourage all PHP developers who haven’t committed to a framework to give symfony a try!
This is a great highlight of some very interesting Symfony features. There are a few things I hadn’t heard about before- the Web Debug Toolbar jumps out at me the most. That seems like a very useful feature which, if it works as advertised, must be an incredible time saver.
It sounds like Symfony is working well for you, but I would encourage you to take a look at Zend Framework 1.5 if you haven’t already. We’ve made a lot of improvements to our codebase and our docs. Some of Symfony’s more advanced features will take a bit longer in ZF if they are implemented at all, simply because we’ve chosen not to rely on conventions for any of our tools.
In any case, best of luck with whatever framework you’re using!
, Wil
@Wil Sinclair: Thanks for the info on the new version of the ZF. I’m glad that I was able to provide you with some insight into the symfony framework that you may not have been aware of.
I just took a look at the new features of ZF on your site and it does look like there have been many improvements since I last checked it out. I’m sure that I will eventually try it out again for some future projects to see the improvements.
Your search of PHP frameworks was my first assignment on my last work. I was already biased towards symfony, because I had used it in some previous projects, but I was open to finding pros and cons in the other frameworks.
The fact was that only symfony was powerful enough out of the box to put into production. Its “view” layer was the most powerful of all 3 frameworks (at least without heavy modifications) and it helped us speed up our new projects (which had to use Smarty templating).
Great stuff, I really like symfony
I’m not sure if I totally agree with you in regards to Zend. We have recently moved from Symfony. We work with several clients in the corporate sector. We have decided to not use Symfony for future client projects (thought this might be of some interest to you): http://blog.kwiqq.com/2008/08/12/announcement-bye-bye-symfony-hello-zend/
Pretty nice article. I just stumbled upon your weblog and wanted to say that I have truly enjoyed surfing around your website blogposts. After all I’ll be subscribing to your feed and I hope you write again very soon! wycieraczki