Which PHP framework would you use today for a brand new application?
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.
(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
Mhabub Mamun replied on Fri, 2011/03/18 - 9:06am
David Allix replied on Fri, 2011/03/18 - 9:41am
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
Kenneth Mccall replied on Fri, 2011/03/18 - 1:44pm
Giorgio Sironi replied on Sat, 2011/03/19 - 6:20am
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
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
Roger Padilla replied on Mon, 2011/03/21 - 1:44pm
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.