Saturday, June 23, 2007

Taking a look at ten different PHP frameworks

Zend Framework

The Zend Framework is still pretty new, and very beta, so there's still a few things to come (like a user authentication module), but it does already have quite a lot. Although it doesn't have a lot of checks in the chart, the Zend Framework does include other modules, to handle PDF files, RSS feeds, Web Services (Amazon, Flickr, Yahoo), and more. The Zend Framework also includes several different database objects, making it extremely simple to query your database, without having to write any SQL yourself.

At the moment the Zend Framework doesn't come with a full-blown ORM, but the framework developers are still debating whether to add an ORM layer or not. This might be something we see in the future, and you can always write your own ORM implementation, and have it added to the framework, as it accepts user contributions.

The Zend Framework is looking quite promising, and is definitely working to fix the common PHP problems. The stable version will probably have a lot more checks in the comparison chart!

CakePHP

CakePHP is mostly an advanced MVC framework, with a few extra modules added on top. It can handle most of the database stuff for you, and it includes support for Ajax and data validation. It also has a unique user authentication module called 'Access Lists', which can be used to give different users access to different parts of your CakePHP website.

This framework seems quite thorough and ready for use, although the CakePHP website is extremely confusing. There doesn't seem to be a stable version yet, which is a bit surprising since it's been in development for months now, but I guess it's probably possible to use the beta version on a production website as well.

Symfony Project

As you can see from the chart the Symfony Project seems like a very extensive framework, and it even includes a full-blown ORM, called Propel, which is another open source project and probably one of the best ORM solutions for PHP. Symfony also includes Creole for the database abstraction layer and Mojavi for the Model-View-Controller model layer. Because it simply re-uses these other projects, instead of re-writing them, this framework probably has the most extensive functionality, and this is clearly shown in the chart.

The only two downsides to this framework is that fact that it can't be run on PHP4, but this is pretty logical considering it needs much of PHP5's new features, and that it's so complicated. Most of the tasks, like paging, are much more complicated in Symfony than in other frameworks, and simplicity definitely doesn't describe this framework.

Seagull Framework

The Seagull framework seems like a pretty good framework, and it comes with quite a lot of features. Another positive thing is that it runs on PHP4 as well, which is a really good thing in my book, as I still use PHP4 and most web hosts don't support PHP5 yet.

Unfortunately Seagull doesn't come with any Ajax support, which is a bit of a shame, but a simple Google search returns a tutorial on adding Ajax support yourself, and it's likely it will be added in the future.

WACT - Web Application Toolkit

WACT looks quite promising, and it has the basic things a framework needs, like MVC, database objects and a template engine, but that's about it. It doesn't have any extra modules, and it definitely lacks a few inbuilt things, like Ajax, caching, an authentication module and more.

WACT does have one of the best template engines though, and it even allows you to create your own template tags to add certain functionality.

Prado

Prado is a very unique framework, and it offers some really cool features. It doesn't come with inbuilt support for MVC (from what I can tell), but it does have all kinds of components to handle most of the usual PHP tasks, and what's even neater it that it makes event-driven scripts possible. For example, it's possible to set an onClick event on a HTML button that links to a PHP function. This closely resembles ASP.NET, and Prado contains more ASP.NET components, like a GridView and a Repeater Control.

By looking at the comparison chart it might seem that Prado is a bit weak compared to the others, but this isn't true. Because Prado is so unique, it doesn't score a lot of points on the chart, but in reality it is very powerful.

PHP on Trax

This framework seems to be a PHP port of Ruby and Rails, and used to be called PHP on Rails. Unfortunately documentation is quite sparse, so it's hard to determine what this framework offers, but its documentation does mention ActiveRecord, so it probably offers ActiveRecord, just like RoR. Another thing it includes is inbuilt support for Ajax, and the two demos that can be found on the website clearly show this.

PHP on Trax is on the right way, but it's still missing a few things, like an authentication module and a caching module. It doesn't have any extra modules either, so it's all a bit basic at the moment.

ZooP Framework

The ZooP Framework is really feature-packed, and as the chart clearly shows, it supports almost anything, except for an ORM layer. What's even more surprising is that it runs on PHP4, which is really exceptional considering all the functionality it offers.

Another thing ZooP offers is inbuilt GUI controls, making it very easy to create forms quickly. It supports most of the basic form elements, and that advantage of using GUI controls over regular HTML is that you can tightly integrate validation logic with the GUI controls.

eZ Components

ez Components isn't so much a framework, but more of a collection of components, and that's probably why it doesn't come with inbuilt support for MVC.

It comes with most of the usual components, like a database component and a caching component, but it's also lacking a few things. For instance, it doesn't have a ActiveRecord component or a authentication component. On the other hand, it does have a few other extra components, like an e-mail component, but there aren't many, and other frameworks (like the Zend Framework) offer more.

CodeIgniter

CodeIgniter is a relatively new framework, by the makers of ExpressionEngine, and it looks quite promising. Unfortunately, it doesn't handle multiple databases yet, although that is in the works.

It's inspired by Ruby on Rails, and it offers much of the same functionality, like scaffolding. It has excellent documentation, and they've even got video tutorials to get you going.

And the winner is...

I'm going to have to disappoint you here, as there isn't a winner. Each framework offers different functionality, and there is no clear winner. Just like most things, it comes down to preference and personal choice. I highly suggest you look through the documentation of each framework above, and decide yourself which framework you like best.

Personally, I really like the Zend Framework at the moment, but as I've been investigating each framework, I've seen many other interesting features, like Prado's events or Symfony's ORM implementation.

If you absolutely can't decide on what framework to use, you can always do what most people do: write your own. It may take more time, but it's a hell of a lot fun.

If you have any comments or questions, feel free to drop them in the comments below or join us at PHPit Forums. Also, if you find any incorrect information in the chart or this article, please let me know so I can correct it.

1 comment:

Jignesh said...

Basically all PHP frameworks are crap. As per Rasmus's statements, make your own framework, which will give you more freedom during development.

- Jignesh (http://jignesht.blogspot.com)