I am a programmer and architect (the kind that writes code) with a focus on testing and open source; I maintain the PHPUnit_Selenium project. I believe programming is one of the hardest and most beautiful jobs in the world. Giorgio is a DZone MVB and is not an employee of DZone and has posted 638 posts at DZone. You can read more from them at their website. View Full User Profile

Which PHP framework would you use today for a brand new application?

03.17.2011
| 13532 views |
  • submit to reddit

While working on a PHP application, you are not forced to adopt a framework. However, many of us choose to borrow an architecture and technical expertise from a popular framework, instead of reiventing many of the components we need.

However, one of the difficult parts of framework adoption, especially in the PHP world, is about choosing the right framework. There is a proliferation of open source solutions and a team must analyze the overall picture thoroughly before locking itself into a particular framework. Changing the framework which an application is built with without shaking its foundations would be probably impossible after a certain period of development.

Parameters

What do you look for when choosing a framework? Here are my example parameters.

  • Functionalities: MVC architecture, database access support, authentication, authorization, caching, logging... Sometimes frameworks compete on features, although the picture is moving towards more interoperability, for example with Symfony adopting some components of Zend Framework.
  • Performance: introducing a layer between the HTTP request and your code is of course going to slow down the application, trading it off for convenience. But frameworks try to fight this issue and avoiding a bloated framework can be a part of the choice.
  • Community, support and life expectancy. Since an application is locked-in with its particular framework, we have better make sure that the framework will live long and prosper. A selling point of the major PHP framework is a company behind it whose best interest is continuing the framework (such as Zend and Sensio).
  • Licensing: this can be an issue for client-side frameworks like Ext JS, but most of the PHP frameworks worth talking about come with an MIT or BSD license, which are the most liberal open source license. You can integrate the framework in your proprietary application without any issues, and frameworks like Zend protecte you also from possible Intellectual Property issues by forcing a license agreement on each contribution.

I framed this question differently because I do not want to talk about legacy applications, or lock-ins you are already experiencing. Consider a green field and not your current applications.

I omitted also version numbers to avoid fragmentation: it's up to you choosing a stable version or one of the pre-release innovative ones.

Zend Framework
35% (412 votes)
Symfony
25% (293 votes)
CodeIgniter
24% (274 votes)
CakePHP
10% (111 votes)
Kohana
2% (26 votes)
Solar
0% (2 votes)
Agavi
0% (1 vote)
Other (specify in the comments)
4% (45 votes)
Total votes: 1164
Published at DZone with permission of Giorgio Sironi, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Łukasz Kolczyński replied on Fri, 2011/03/18 - 7:36am

What about Yii ?

Mhabub Mamun replied on Fri, 2011/03/18 - 9:06am

CodeIgniter is best MVC framework for PHP. Its faster,easy to use and have  lots of facility

David Allix replied on Fri, 2011/03/18 - 9:41am

Is CodeIgniter always php4 compatible with old code ?

Too bad for me, it's time to go to a fully php 5.3 framework as symfony 2 which will be finalized very soon or ZF 2, but for this last, they are late...

Wojciech Soczyński replied on Fri, 2011/03/18 - 11:21am

I think, you miss, one very important option -> "Your own framework" ;)

Kenneth Mccall replied on Fri, 2011/03/18 - 1:44pm

Kohana? FuelPHP?

Giorgio Sironi replied on Sat, 2011/03/19 - 6:20am

Of course it is implicit that you want to select an existing framework in this poll; a personal/corporate framework is not available to the public, so it's left out of the options. :)

Ferenc Kovacs replied on Sat, 2011/03/19 - 6:25am

it depends on the project.

there are pros and cons for every major framework, and there are cases when you have to write your own (either because the project is too small for full fledged framework, so you go with the no-framework framework, or because it is to specific to be easily covered by the general frameworks, etc.)

I've just needed to set up a small sideproject,  and I've found the major ones like zf and symfony too much overhead, or too much work to scrap everything that I don't need.

and I've also checked the existing micro frameworks, but putting together a few hundred lines was easier to be done than using one of those.

 Tyrael

Romans Malinovskis replied on Sat, 2011/03/19 - 10:42am

I use Agile Toolkit. It's a very new Web framework. Biggest difference is that it's focused on User Interface development, jQuery integration, Simplicity and Scalability. Check out interactive introduction http://agiletoolkit.org/intro

It's offered under dual license - AGPL and Commercial (which includes support). I personally like this better then MIT or BSD license - when you take something, you should give something back.

btw: registering on this site greeted me with sql error:

user warning: Duplicate entry 'cb98f16d38............' for key 'PRIMARY' query: INSERT INTO dz_reg_attempts (token, sid, attempt_number, time_of_attempt, data, errors, site, form_type) values('.........

Marco Patania replied on Sun, 2011/03/20 - 10:51am

www.yiiframework.com

Roger Padilla replied on Mon, 2011/03/21 - 1:44pm

Yii framework: modern, fast and easy.

Ant Cunningham replied on Sun, 2011/04/10 - 2:59am

Every project is different so we end to tailor framework usage to a project. That said we use Symfony and/or Zend exclusively.

 For medium and large projects Symfony is used as the core and sometimes we will throw in components from Zend for certain things (Zend_Search_Lucene being the most common. Symfony wins out on large scale projects because its got a full feature set and the most powerful tooling out of all the PHP frameworks. And to that the fact the its jsut as customizeable as some of the lighter options and its really a no brainer.

 For smaller projects we use a custom stack of Zend that includes MVC, Forms, and DB (which we are in the process of switching out in favor of Doctrine2 DBAL) components and a super-light data mapper we wrote for it that integrates with Zend_Form to take some of the tediousness out of development. We would never use Zend for a large project though, there is just too much glue to write and configure and developing tooling with Zend_Tool is a horrid experience.

We tried some of the lighter frameworks everyone raves about for speed and ease of use (CI, Kohana, Yii) but at the end of the day they just didn't do enough of the background work for us so we could concentrate on the key business logic we needed to concentrate on. This was especially true for because the performance of we'rent that big a of deal because we generally use a lot of caching anyhow.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.