php frameworks – my opinion

I heart PHP. I’ve been working with it in one form or another for over 8 years — back in the PHP 3 days, even! I’m entirely self-taught, relying on php.net and tutorials to help me figure out how to do stuff.

Last fall I was working on a niche-oriented CMS and was getting majorly bored/burned out by all the procedural stuff; the code felt horribly messy to me and I wanted to get into OOP (Object Oriented Programming) but previous attempts had left me scratching my head.

Somehow I stumbled on CodeIgniter and I was immediately hooked. Once I figured out my way around MVC and their way of doing things I tripled the amount of code I was able to put out. Was my code the best you could ever find? No, but it was definitely a step ahead of where I’d been.

Once I finished the CMS I decided to tackle another project and turned again to CI. I’ve been working on this project for the majority of 2008, and might have it done by the end of the year.

Now, I really love CI because it’s so easy and flexible, and it’s pretty much agreed that they have the easiest to understand documentation. However, I began to get frustrated with some of the features the default CI lacks – Auth being the biggest — so I started “shopping around” some other popular frameworks. Following are the ones I dabbled with. Note that there are no benchmarks because frankly that wasn’t my concern — realtive ease of use and the speeding up of my development were the primary concerns was.

Zend Framework – http://framework.zend.com:
Impression: After Symfony, I say ZF is probably the daddy of the frameworks. You can develop some really powerful stuff with it. That said, I found it to have a really steep learning curve and to be too loosely coupled for my taste. Requires more manual configuration than most other frameworks. It took me almost a full day to figure out the Zend_Db class and even then I wasn’t able to move too far with it. I was really impressed with their ACL and Auth classes, although I didn’t get far enough to really dabble with them.
Conclusion: If I had more time to play with it, I’m sure I could figure ZF out and develop some really cool stuff. For now, I will most likely stick with implementing components of ZF with other frameworks.

CakePHP – http://www.cakephp.org
Impression: One of the most popular frameworks. Pretty strict with naming conventions. Models are a must (this is not a bad thing). I actually played with this for a couple of days and got a lot farther with it than I did with ZF. The docs (2.2) are pretty good and I was able to find almost everything I needed to know within them. Because it’s so popular, finding things that weren’t in the docs — like a form tutorial — was really easy.

Conclusion: I may go back and try my hand developing something with Cake. If you have moderate experience with MVC, it’s not (IMO) that hard to learn. It’s a lot slower than pretty much any other framework but it also does a lot of stuff for you that could speed up your production.

KohanaPHP – http://www.kohanaphp.com
Impression: Kohana is a relative newcomer to the PHP Framework scene; it originated as a fork of CI when a bunch of CI developers got tired of waiting for EllisLab (creators of CI) to fix bugs with CI. Right now the current release is 2.2 (I think) and while a lot of things are different from CI, it’s still feasible to port CI apps to Kohana by renaming a few things and following some different rules, like using helper::helper_function instead of $this->load->helper(‘helper’) and helper_function(). I wasn’t very impressed with their docs; I found reference to the “Forge” class, that helps consolidate form creating/validation rules, only to find out Forge has been depreceated in Kohana 2.2.
However, Kohana does seem very powerful and I don’t think it would be too big of a leap to go from CI to Kohana. I really like that they have an advanced archive class as well as auth and payment modules.

Conclusion: I will probably use Kohana at some point; I may even recode the 2nd draft of my current project in Kohana since it provides more built-in functionality than CI does. I really like that it is community based; however, from what I’ve read the framework seems to depreceate things fairly often, which could make developing with it a pain in the ass.

CodeIgniter – http://www.codeigniter.com
Impression: As I said, I love CI. It was so easy to learn and really helped speed up my PHP production. The community is awesome, the docs are awesome, and it’s so flexible I can do pretty much anything I want with it. The “bare-bones-ness” of it, though, is also frustrating at times, especially when I have to manually code something in that the other frameworks provide by default — again, mainly Auth stuff. I think it’s kind of neat that it’s used and backed by a company (EllisLab, which produces the Expression Engine commercial CMS), which should provide security as far as it being around. The bad thing about that is that since it’s developed and maintained by a company, fixes to bugs and other issues can take a lot longer than a community driven framework. I’d really like to see CI get into module-type stuff or at least include company-supported libraries like auth and payment.

Conclusion: I will likely stay with CI for now; when I get more time to dabble with Kohana more it will become more of a competition in my mind. I have to say, though, that for each (hee!) framework I tried, I ended up going back to CI with relief mostly for its flexibility. That could just be due to my being most familiar with CI, though.

To wrap it up, my choices would likely go like so:

  1. CodeIgniter
  2. Kohana
  3. CakePHP
  4. Zend Framework

I know that this hasn’t been a very “techy” type of comparison; as the title suggests, these are merely my opinions on the 4 frameworks I’ve tried out. Eveyrone has one that clicks for them, and you’re definitely entitled to use that one and call it the best (for you!).

Advertisements
Previous Post
Leave a comment

6 Comments

  1. hmvrulz

     /  September 27, 2008

    thanx…. wht you think about writing your own framework.. any suggestions how to start

    Reply
  2. fast times at sweet valley high

     /  September 28, 2008

    @hmvrulz: I’ve never tried writing my own framework from scratch, so I’m not sure everything that’s involved.

    If I had to venture an opinion, I’d say even something as simple as a good database abstraction layer coupled with some functions and classes you tend to re-use over and over would be a great way to start. 🙂

    Reply
  3. I’ve had pretty much the same experience and agree with your ranking. I’ve come to think of the negatives you’ve mentioned as their best feature. Instead of saying “This is our auth system and you have to use it like so…” CI give’s me the freedom to do it the way I want or to use pretty much any other existing code. It’s a meat and potatoes framework that let’s you make the gravy. I believe CI is a hackers framework. It stays out of your way to let you develop your app instead of doing it for you. Convention over configuration is only good to a point, past it, it stifles innovation.

    P.S. just came across your blog from my Google alerts on CI. Subscribed. I think it’s awesome that you’re a programming mom. Not enough of those.

    Reply
  4. I agree, but at the same time; it’s hard to build an Auth system and not build the house.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: