Taking a look at ten different PHP frameworks

来源:互联网 发布:福特级航母知乎 编辑:程序博客网 时间:2024/06/10 09:20

URL: http://www.phpit.net/article/ten-different-php-frameworks/1/

Introduction

PHP frameworks are the latest hot topic in the PHP community, and new frameworks are being released daily. With over 40 frameworks available it's difficult to decide which framework works best for you, especially as each framework offers different functionality.

In this article we will look at ten popular frameworks, and compare them to each other. First I will give you a general chart which gives you a quick overview of all the frameworks, and after that we'll go through each framework and discuss it in short.

A Quick Overview

Below you can view a chart of the ten frameworks, and what functionality each frameworks offers.

Framework PHP4 PHP5 MVC1 Multiple DB's2 ORM3 DB Objects4 Templates5 Caching6 Validation7 Ajax8 Auth Module9 Modules10 Zend Framework - YES YES YES - YES - - YES - - YES CakePHP YES YES YES YES YES YES - YES YES YES YES - Symfony Project - YES YES YES YES YES - YES YES YES YES - Seagull Framework YES YES YES YES YES YES YES YES YES - YES YES WACT YES YES YES YES - YES YES - YES - - - Prado - YES - YES - - YES YES YES YES YES YES PHP on TRAX - YES YES YES YES YES - - YES YES - - ZooP Framework YES YES YES YES - YES YES - YES YES YES YES eZ Components - YES - YES - YES - YES YES - - YES CodeIgniter YES YES YES - - YES YES YES YES - - YES #1: Indicates whether the framework comes with inbuilt support for a Model-View-Controller setup.
#2: Indicates whether the framework supports multiple databases without having to change anything.

#3: Indicates whether the framework supports an object-record mapper, usually an implementation of ActiveRecord.
#4: Indicates whether the framework includes other database objects, like a TableGateWay.
#5: Indicates whether the framework has an inbuilt template engine.
#6: Indicates whether the framework includes a caching object or some way other way of caching.
#7: Indicates whether the framework has an inbuilt validation or filtering component.
#8: Indicates whether the framework comes with inbuilt support for Ajax.

#9: Indicates whether the framework has an inbuilt module for handling user authentication.
#10: Indicates whether the framework has other modules, like an RSS feed parser, PDF module or anything else (useful).

Click here to open the chart in a new window

If anything in the above chart is incorrect, please let me know so I can correct it.

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 inbuilt caching module and an ORM. 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.

原创粉丝点击