There is an enormous number of PHP frameworks available so I thought I share my experiences working with some of the most popular frameworks for PHP development. I have personally used all of the frameworks I describe either for my own projects or for actual client work. Here are my notes on how I evaluated various PHP frameworks and why I chose the PHP Fat-Free Framework as my PHP framework of choice.
CodeIgniter
The first PHP framework I used for a real project was CodeIgniter. At the time, it seemed really easy to get started, had great documentation, and an active community. I didn’t want to pick a framework that would die out and then leave me stuck with a client site running a dead framework and CodeIgniter seemed well respected and established. I used CodeIgniter on at least three client projects and several internal projects as well. I became quite familiar with the framework and it had many features that I found extremely helpful.
There were, however, a few things that irritated me when developing projects on CodeIgniter. First, at the time, it was a PHP4 framework. Not that this was a major problem because I could still write my own PHP5 classes and run everything on PHP5. Nevertheless, it was a bit annoying to know that the framework could be so much better under the hood if it would just take advantage of PHP5. This has since been resolved with the release of CodeIgniter 2.0 which now requires PHP 5.1.6 or newer.
The second irksome issue was that the Model in the Model-View-Controller paradigm of CodeIgniter wasn’t really a “model” in the traditional since. CodeIgniter models are all singletons. I like to have the model correspond to a row in a database table where the column names of the table are the properties of the model. In CodeIgniter, however, the Model represents the table as a whole rather than a row in the table. This never really worked well with my coding style or thinking so I ended up designing my own models, thus, not really taking full advantage of what the framework could/should be providing.
After a few projects with CodeIgniter, these quirks got the better of me and I began looking for a new framework.
Zend Framework
The next framework I worked with seriously was the Zend Framework. This seemed like a good framework to use because it clearly wasn’t going anywhere since it’s backed by Zend. The community was growing and active and the documentation was relatively good as well. The Zend Framework is a gigantic gorilla of a framework. In fact, many people don’t even refer to it as a framework but rather a PHP library. The Zend Framework has classes to do just about anything you can think of. It’s is purely a PHP5 framework and it did not have the model/singleton issue that I was bothered by with CodeIgniter.
First off, the learning curve for Zend Framework was enormous, especially compared to CodeIgniter. It was not difficult because none of the concepts were new. It was just extremely time consuming because of the size of the framework and the lack of any clear “best practice” tutorials. With the Zend Framework there are bunches of ways to accomplish the same things and I was constantly left wondering if the path I was taking was actually the proper way to be doing what I was trying to do. I felt this way with everything from the bootstrap file to the unit tests. The entire thing was just a mess to work with. Today things are a little better because there are more tutorials online to help guide your through the framework. Be that as it may, if you want to get started with the Zend Framework you need to devote a significant amount of time to bring yourself up to speed on how all the pieces fit together.
Another issue I had was that many of the class names and method names in the Zend Framework are really long. Again, this isn’t really a problem per-se, it’s just annoying. For example, right from the get-go when you set up your bootstrap file you extend ZendApplicationBootstrapBootstrap. Then, to set up your error handlers you access ZendControllerPluginErrorHandler. The long names are mostly due to the fact that the framework is huge with a very large number of classes and the class names denote their location within the directory structure of the framework.
I worked with the Zend Framework for over a year building an electronic medical record system which included SOAP clients and servers, classes to automate email retrieval, and, of course, an MVC web application for interacting with and managing medical records. After wrapping up that project I was interested in exploring frameworks again. Working with the Zend Framework felt like walking through peanut butter. I was ready to see if there was something a little lighter.
Exploring PHP Frameworks
I explored Kohana because it was essentially a PHP5 version of CodeIgniter. Kohana has many new/different features from CodeIgniter, but the general paradigm is quite similar. I liked Kohana, developed an internal project with it, but by this time I had also been developing a Ruby on Rails application and had tinkered about with Sinatra both of which are Ruby frameworks. So, I wanted to see if there was anything more like those Ruby frameworks in the PHP world.
I took a look at CakePHP and also Yii. I preferred Yii, but both of these frameworks were really nice. I did not do any client projects with either framework but I did put together an internal project with Yii. I really liked it a lot. The one big thing that I didn’t like about Yii was that I needed to make a RESTful API for a project I was working on and it wasn’t very easy in Yii to pull that off. Yii would prefer that I use SOAP, which it makes quite easy, but I really didn’t want to go that route. Yii is a really awesome framework though, and if you don’t need a REST API then I certainly recommend giving it a try.
What I really was after, was something more like Ruby’s Sinatra. It’s easy to make a RESTful API, it’s super lightweight and easy to use. So, you might ask, why not just stick with Ruby and use Sinatra? Well, by this time I had begun hiring other folks to work for me. While we do consulting work as well, our primary line of business is WordPress plugin development. My company Reality66 is the company behind the Cart66 WordPress Ecommerce Plugin. We already had a significant in-house library of PHP classes and scripts. The folks on my team are PHP developers, and all our servers are primarily set up to run PHP/MySQL apps. While I personally enjoy learning new languages and frameworks, I didn’t want to have to train my team on a new language and platform. Since we are so heavily invested in WordPress, I’d have to hire folks who were both PHP and Ruby gurus. So if there was a framework that was written in PHP but used the principles of Sinatra then that would be ideal.
Fat-Free Framework
As it turns out, there are several Sinatra clones in PHP. The oldest is probably Limonade which has been around since 2009. Oddly, however, it doesn’t seem to have much of a community around it. Likewise, Slim is another “micro” PHP framework without much of a following. Slim looks like a pretty slick framework though. It’s got a nice feature list including RESTful routing. Nevertheless, I kept on looking.
When I came upon the Fat-Free Framework I was immediately intrigued. The entire framework is condensed into a single 55KB file. There is also a library of additional plugins which you can use if you’d like. The Fat-Free Framework, sometimes referred to as F3, includes a RESTful routing engine, views and templates including its own templating markup language, data mappers and a SQL handler for working with databases, and even includes its own unit testing framework. The documentation of reasonably thorough. The framework is under active development and some of the most recent features sometimes out pace the documentation. Be that as it may, the documentation is still very good and since the framework is such a manageable size, you can just read through the source code to figure some things out if the documentation isn’t clear.
I have been working with the Fat-Free Framework now for about a year on and off. Recently I’ve started two new projects that I am building on top of the F3 framework. I plan to write an entire series on how I use the F3 framework including how I organize my application, how I use the F3 testing framework, and will be sharing some of my own PHP classes that I’ve written for use with this awesome framework.
In summary, here are the reasons why I selected the Fat-Free Framework as my framework of choice for PHP projects:
- Very light weight, quick to learn, and easy to use
- Easy to incorporate your own library of PHP classes or other libraries from other frameworks
- Fat-Free Framework is a PHP 5.3 frame work. Takes advantage of the latest and greatest that PHP has to offer – including namespaces!
- Very good documentation
- The framework author listens to the needs of the community and does a great job implementing needed features and fixing bugs.
- Includes a unit testing framework
- Includes a great templating engine. It is an optional feature but helps keep your code organized by reminding you not to write PHP code in your views.
- RESTful routes
- Extremely flexible – organize your code and your application however you like.
- Easy to keep your configuration information separate from you application logic.
- It works the way I expect it to work with very few exceptions.
In my upcoming series on the F3 framework, I’ll be going into more detail on some of these points. In the mean time, I highly encourage you to download the Fat-Free Framework and give it a try.
any comments on the FuelPHP Framework.
Yes! FuelPHP has a very cool website, awesome screencasts to show you how to get started, uses PHP 5.3 and takes advantage of namespacing. It is a fairly new framework and just reached it’s 1.0 Final in July of 2012. Because of its newness, when I was picking a framework for the projects I am working on now I didn’t feel comfortable using such a new framework. If I were starting a new project today, I would certainly give Fuel another look. It’s got a great (and large) team of developers and significant community support with 48 contributors in GitHub (as of August 2011).
The overal approach that Fuel takes is more like Ruby on Rails than Sinatra. Fuel is an MVC framework that uses oil, it’s command line component, to generate code to help jumpstart your project. As such, it’s a lot heavier than the Fat-Free Framework in the sense that it needs a lot more code (and files) to get going. I have not developed anything with Fuel so I didn’t include it in my review. It uses the same sort of routing approach that CodeIgniter uses and I have grown quite fond of the RESTful routes in the Fat-Free Framework. It’s awesome to be able to just set up a file that has all the routes for your application and not force the routes to depend on your directory structure or file names. When coding with the Fat-Free Framework I am constantly astonished by how little code I need to write (or need to generate) in order to get things done.
Thanks that makes sense. I am a designer trying to set my foot into PHP development. So I need something thats easy to work with and get going.
where is symfony?
since Lee is searching something like Sinatra, more REST oriented and without MVC burden, my question wouldn’t be “where is symfony?” but “are you aware of silex?”
Wow this is a great looking framework too. I didn’t know about silex. Thank you very much for sharing this! I’m going to go do a little more reading up on this right now.
Check Laravel too! It’s another cool framework 🙂
Nice! Laravel looks like a very interesting PHP framework. Clean site, RESTful framework, good documentation with plenty of “getting started” information, and the code is available on github which suggests that the framework authors may be open to community driven development. Certainly a framework to keep your eye on.
+1
I found Lavarel a week ago and I’m fascinated. Really cool.
Hi Lee,
Thanks for the nice review. How about the F3 write-ups and classes of yours you promised to share. We are waiting or I am waiting. 🙂
i’m very very new to PHP Framework, could anyone suggest what framework is best for me?
Another PHP framework you should definetely explore is DooPHP (somehow is a lighter version of yii for me). It is labeled as “The fastest MVC based php framework”.
PHP web development isn’t as tedious as it seems to be. Thanks to the easy availability of a number of frameworks which make it quite convenient to execute simple and complex PHP web development projects with absolute amount of ease. If you’ve ever chosen a PHP developer for hire purpose, you must have definitely come across the Laravel framework. Designed for the MVC(Model-View-Controller) applications, Laravel is a PHP framework you can’t afford to miss.
http://laravel.com
You compare the best php frameworks? or the best you use?
I can see anything about symfony in your post or YUI Framework.
Zend Framework have a great backed like Zned, like you say, and have a great team.
Symfony is other project like ZF, big and strong. You mention Codeigniter, but it’s the worst popular framework ever. it wrote by monkeys.
The best PHP framework are, Zend Framework and Symfony. Maybe you can use other, but the better are that two.
“it wrote by monkeys”… ? LOL
I bet the only people who uses Symfony and Zend are “monkeys” being told so by their boss who doesn’t care about coding experience and performance, as long as it looks like it’s “backed up” by some company.
The truth is, you won’t get “corporate” support with them like what you are trying to imply. You still post in forums for your troubles just like all frameworks.
Great team? You probably haven’t seen how a lot of people think that ZF is going the wrong way.
If you like Symfony or Zend then you prefer the hard / bloated way of doing things. I bet you probably haven’t built any significant project of em huh?
LOL Serves him right. I don’t understand why people fight over frameworks! If you don’t like a framework,just leave it and move on @Pablo.
Wondered, you have no mentioning of Recess Framework, and have you tried Zend to do RESTful
If i have to go live with a framework for my REST server, which one would you bet on?
Useful review Lee, thanks. I’m also interested in reading more about how you structure and manage your F3 applications. I’ve used a number of frameworks; F3 seems significantly easier than any of them and I’m keen to get amongst it.
Hi Lee, very interesting review, thanks. Are you still using F3? I’ve just started to study it and it would be great to know how you structure your projects. Regards.
I prefer Yii, after symfony,codeigniter and kohana.
symfony complex, codeigniter and kohana is simple.
Yii like a swiss army knife. You can build easily admin panel with Gii. Also widget ready system help you for faster complete frontend side.
Thank you for article.
Symfony 2 is not a simple framework, it’s a great application framework. it’s a J2EE platform but written in PHP5.3
Try it and you will feel the difference… But keep in mind, it is not for noobs !
symphony is the best…
Hi framework users. I have used fat free for the first time and its working great. However I am getting errors with the base.php file in this function and any other that are similarly structured:
static function getfile($file) {
$out=FALSE;
if (!function_exists(‘flock’))
$out=self::mutex(
function() use($file) {
return file_get_contents($file);
},
$file
);
elseif ($handle=@fopen($file,’r’)) {
flock($handle,LOCK_EX);
$size=filesize($file);
$out=$size?fread($handle,$size):$out;
flock($handle,LOCK_UN);
fclose($handle);
}
return $out;
}
Hi Lee,
Very nice review. You convinced me to give F3 a try. Thanks a lot!
Thanks Lee for this take on F3. I’m working with Yii at the moment and I must say it saved my life! Did a memory test on it and it rates amongst one of the lowest between 2.x to 5.x MB for my app, albeit I feel a little of bloat after a while with the codes. But F3 seems to beat this even, so it is great!
I’ve ran through the entire F3 docs and it seems really elegant. After all, dynamic web apps all begins with a URL Request and F3’s route-driven approach is making a great deal of sense.
Not sure if you have released any article on your experience in how your organise your project with F3. Would be great for the community to gain from this!
God Bless!
Thank you for the great act, letting us to be brightened from your experiences.
Less than 2 years ago I switched on asp.netC# to work with a team and it was a great experience for me as a 23 self-educated developer to learn asp.net from start to Control Development and being an advanced with a lot of asp.net issues, Recently because of the current problems within middle east I had to leave them so I came back on php as a freelance. BUT
Because I had no experience with php frameworks excepting a few about web 2.0 app(zend&smarty) I tried to make my php.net framewrok because I thought zend is so huge to learn.
Now however some of my php.net such as ajaxpanel/repeater&listview/viewstate/webcontrols and many more are ready but I haven’t paid enough attention to separating view from codes(such as C# from asp markups) (It’s truth and I’m not joking).
For this reason I have intended to be good boy and move on ready MVCs and this article was so good.
Actually F3 is awesomely easy, lightweight and with sweety syntax and patterns But
I found nothing when I looked for F3 AJAX and when I searched about it for Zend Framework the article on the below address was a great subject for me with the Zend components because I’m almost expert with javascript and jQuery(related to json):
http://www.smooka.com/blog/2009/04/17/5-things-working-with-zend-framework-and-ajax/
It describes about : isXmlHttpRequest() + JSON action helper + AutoComplete + ContextSwitch + AjaxContext
There is one big downside to FatFree. And that is the vague licensing. It’s GPLv3 for academic and non-commercial use. But he doesn’t say what the licensing is for commercial use. You have to contact him and probably pay some unknown amount. But then he also says if you make a commercial gain to please consider a donation. Which is it? I’m cool with donating, to any project no matter how it’s licensed. But the uncertainty of not having a clear license is a huge downside. And I’d say that’s part of what’s holding back that community too. He should just spell it out.
FuelPHP and Silex are all licensed MIT. Cogeignitor is OSL and okay for commercial. Kohana is BSD. They are all clearly ok for commercial. Why take the risk with F3?
My 2 cents.
I contacted the author. The phrasing of the website is less than ideal, but the intent behind it is the same as with things like MySQL:
Use it under the terms of GPLv3 for anything, or pay extra to license derivative works under alternate terms.
Basically, the phrasing of the website assumes that nobody will want to use it commercially under the GPLv3.
Also, from what I remember, you actually can’t restrict the GPLv3 to non-commercial use only. That would require changing the text of the license, which apparently terminates your right to call it “GPL” and certainly makes it incompatible with genuine GPLed code for ANY use.
You could refuse to give copies of your creation to commercial users, but if you give it to academics or personal users under the GPLv3, then THEY are well within their rights to give it to commercial users.
Same thought here.
totally left it behind because of its licensing.
Since this comment was posted, the creator of FatFree has clarified the license. It’s GPLv3 without any alterations to the license. (GPLv3 actually requires that no alterations or stipulations be made of it.) So that’s good.
https://github.com/bcosca/fatfree#fair-licensing
i work in a software company and i work in cakephp. there is another group that works in Yii framework. I think cakephp is an excellent framework. I have not used other frameworks so i dont know how it measures up to other. but what can f3 do that cakephp cannot?
F3 is a dramatically different type of framework than CakePHP is. F3 is much lighter weight, without the need for command line generators. I suppose it’s a matter of preference and project size, at least to some degree, but I like to keep everything is simple and small as possible and F3 does a great job at meeting that need.
My company is looking to create a new form of crowd technology, and PHP initially struck me as the best way to go. But then I discovered that there really isn’t any PHP: just a disorganized mess of incompatible frameworks. This became a real problem when the 3 major sources of existing code we wished to license were all on different platforms. We PHP keep devolving into all these warring tribes, or is there any sign of consolidation into a standard universal platform on the horizon?
@storm: Yes! There is an exciting project that has recently been gaining a lot of momentum that is designed to work similarly to ruby gems but for PHP. In my opinion, you hit the nail on the head with your observation that PHP developers have frameworks but the modules/classes in those frameworks are not usually interchangeable with other frameworks. Even if they were, there is no central location to find and install them. Composer is a project designed to solve this problem. It’s exciting and certainly worth learning about. Here is an article about what composer is and why you want it.
Symfony 2 is not a simple framework, it’s a great application framework. it’s a J2EE platform but written in PHP5.3
Try it and you will feel the difference…
Hi there,
I am looking at hiring a developer and most probably, having the project completed using a framework. My main concerns are 1) security 2) performance (the site still loads pages at the same speed even as the user base grows) & 3) flexibility – easily/quickly adapt the website to a new database type (MySQL to SQL).
What would you suggest would match my needs from your experience?
@BryanLovesPHP: If I were starting up a new project today I’d go with either FatFree PHP (F3) or Laravel. Both of those frameworks will meet all of the requirements you listed. F3 has a smaller footprint and is quicker to learn. Laravel is more comprehensive and is growing quickly in both coolness and popularity.
I’ve switched to Symfony2. I believe it is the best framework available on the market. Very speedy, stable, secure and has a great community. Kind regards.
Does anyone have any experience or thoughts about Slim Framework? I’ve been following @slimphp on Twitter recently and it seems to be picking up steam.
Hey, I found your site while searching for solution to my new project. It’s business application made of several modules with a lot of CRUDs/forms/validation. I have been using Yii framework with success for smaller projects, but this one is supposed to be very long term and may become quite big. At the moment I’m wondering if it’s a good solution to create all business logic as API and then create frontend application by consuming those services. I don’t want to overengineer, for sure it would be much simpler to create and reuse code in Yii and work with db models. I want to use KendoUI as frontend and it looks like it works best with REST and JSON, and Yii works best with SOAP and XML, so I’m wondering A) If it’s good approach to have all business logic as API B) Is there any tool/framework i could use? I really liked working with Yii and i would prefer to stick to it, but creating RESTful API looks more like a hack there not a feature …
I found your write-up of your experiences with various PHP frameworks helpful, as I have started down the same path (starting with CodeIgnitor, Zend Framework, looking at CakePHP and Yii) and have been finding the same general pros and cons. I began looking into F3 today and I feel quite encouraged. Thanks for taking the time to put all this into words.
Thanks for sharing article about framework . I am web developer personally i like cake php and yii framework . i will both of them in future web applications.
i green technologies.
Thanks again .
I personally use Yii. To my mind it`s the clearest and the easiest one, great for beginners. Some reasons:
1. Easy-to-understand documentation http://www.yiiframework.com/doc/guide/
2. Several great extensions like bootstrap http://www.yiiframework.com/extension/bootstrap/,
backvendor http://www.yiiframework.com/extension/backvendor/ and http://www.yiiframework.com/extension/coco/
3. High community and lots of examples
Cake and Symfony2 are also ok, but Yii is the best one.
Simply I prefer ZendFramework 2
Regards
Computer specialists namedropping frameworks – it’s like ordinary people talking aboutmovies. Nice way to spend a couple of hours exploring frameworks. Still I like the no framework approach outlined in Rasmus document: http://toys.lerdorf.com/archives/38-The-no-framework-PHP-MVC-framework.html. This is often the best framework as you at least knows what is going on (you write it yourself).
I believe the best PHP framework / CMS is the Banshee PHP framework. Strong focus on security, easy to use and fast!
Hi, thanks for this article …
I’m interested in building a php app “inside” WordPress and i would like to ask you which is the best way to achieve it.
In other words, and regarding to your experience (cart66), wich is the best way to integrate WP and a piece of software? Are you using some of the framework (F3?) to write your plugin (or part of it)? Have you ever heard about PODS? http://podsframework.org/
regards,
Paolo
I am actually creating my own framework for WordPress plugin development call the phreedom framework. I have plans to release it publicly on github once I have a chance to document it and clean it up. Phreedom is very similar to the concepts in F3 except it doesn’t have much in the way of routing since WordPress handles all of that. Things have been so busy lately that I haven’t had a chance to work on phreedom much. Hoping to find more time soon. Maybe I’ll just put it out there they way it is just so folks can see it… hmm…
I will pick codeigniter as I think it to be one of the best framework which is light weighted, easy to use as well as it allows great separation between logic and presentation.
You should definately have a look at newer frameworks that try to use most of the new features of PHP 5.4
Actually if you look at this benchmark you’ll see that most mainstream frameworks are quite similar in speed with Xcache eneabled:
http://phpixie.com/blog/php-framework-benchmark/
According to me YII is the best PHP framework. It contains automatic code generation tools name GII, and it produces very good clean code.
So,
Where do we stand after one and half year of this post, will you stick stick to fat free framework or PHPixie
Just want to listen to your opinion.
Regards
Mohit
I still have not built an app with PHPixie. The whole fairy theme with the overly sexed intro audio thing weirds me out a little, to be honest. Be that as it may, it does look like a cool framework with good documentation. Nevertheless, I’m still partial to the Fat Free Framework (F3) because it’s so clean and light.
PHPixie provides controllers that you extend with function names like action_add or action_index to define the routes. In F3, you just define the routes. Also, F3 has a great map() feature to make RESTfull dev even easier.
What are your thoughts about PHPixie? What about PHPixie really stands out to you as the most compelling features?
https://github.com/ScavixSoftware/WebFramework
That is a new competitor. You may want to test it too 🙂
Really focused to be productive.
What about YII framework that is also a cool Framework
Yii is a pretty cool framework. If I were going to use a big framework like Yii I’d also look at Laravel and maybe FuelPHP too. Personally, I prefer the lighter weight frameworks and still use FatFree for almost all my stuff.
@LEE -> You stated in another comment:
<blockquote cite=””I am actually creating my own framework for WordPress plugin development call the phreedom framework”>
Are you still working on this? I know a lot of other developers that would love something like this. (Including myself !)
I have a bunch of code I could share but virtually no documentation which is why I haven’t published it. If you are interested, I can stick it out on github and we’ll see what happens. I just don’t have much extra time right now to write documentation.
Zend is best PHP framework because it designers providing a proven sensitive code base. Along with providing secure, efficient and quick web programs.
Zend is best php framework because it execution of versatile desk entrance to accessibility information from a relational information source in an object-oriented atmosphere.
Slim + Redbean (ORM) makes a good combo for lightweight framework.
You can add Twig if you need a template engine.
And Twitter Bootstrap for CSS.
Yii looks promising for bigger projects though.
F3 looks great! Glad I found your article. I just downloaded from github. The included chm file is very helpful, too!
Glad you found F3! It’s a great framework. I just built a complete app including an exposed API using the new version 3 of the Fat Free Framework and it all runs really well.
I used codeigniter, it’s very good,
I like light framework,
F3 is nice, i’m learning it , thanks, Lee.
btw,Looking forward your tutorial about F3.
I am using Zendfox framework, it’s very easy to understand and to use. It’s good to for small & large applications. A cute application architecture that can be manage very easily.
Thanks a lot. I’ve just downloaded F3 after reading this post and after reading F3 documentation. It seems very easy to make things. As I’m just a newbie and would like to have some simple application code: the skeleton, some very basic controllers and views. Just to know how to start … Could you share some? please…
Very relevant information shared in this blog, we are also serving in the same field as award-winning web app development company. Get in touch with us for more.
PHP Development environment is one of the most finest because PHP is open source and is constantly updating. Its versions are getting better day by day, providing extraordinary features
Some of the best PHP frameworks that will roar in 2023 are:
CodeIgniter
Symfony
CakePHP
Yii. …
Laminas Project. …
Phalcon
Fat-Free Framework
Laravel
Thanks for sharing informative content. Great Work
A top-of-the-line hiring platform, Lavorg has more than 1250+ remote developers and programmers available for hire right now!