Which framework is best?

When I started learning programming for internet in 2001, I started with perl. It was a fantastic language and everything was fine. There was absolutely no problem with it. But then, when I tried to host my tiny application in free hosts available that time, I understood that finding a free host for perl was not as easy as finding one for PHP. Though some hosts were offering free perl hosting that time, but there were problems with available modules etc. And I was a noob with very limited resources around me (even I couldn’t access internet all the time, it was costly like hell for me in those days). I started learning PHP. It’s syntax was similar to perl and there was even the friendly “$” sign present, it didn’t take me too much of time to change my application into php. I choose one from the many free PHP hosting providers and my application went live immediately.

Is perl a bad language? Was it a bad language? NO!

But at the end of the day, PHP turns into the best thing for me because there were plenty of resources available, there was a “HELL OF A MANUAL” with user comments and what not.

These days, beginners and fresher asks a common question all the time – “Which framework is best?” . My answer remains simple for them, “none”. If you are planning to learn a new PHP framework or want to choose a PHP framework for your web application, there are some small points you need to consider first.

1. What is my applications going to do?
2. Which framework has a stable community
3. Which framework has good resources available
4. Which framework is under solid development phase and not in a “discontinued” mode?

Once you have the answer, you need to know that there are basically three types of frameworks in nature. Though most of them offers you an MVC or HMVC work flow, yet, they differ in nature.

  • Some Frameworks are too Liberal
  • Some Frameworks are too strict
  • Some of them are over strict and configuration junky

I started with CodeIgniter. It was extremely liberal, allowed me to write very bad code. In those early days, when I was not pretty much aware of the “MVC” convention, I wrote business logic in the controller, even sometime called model from inside a view. I was like “why not? it works” – but I never understood the philosophy of the true MVC application model and continued to write bad code, until I realized the beauty of coding and the value of that in a team work.

I started learning CakePHP, but well, that time its strict coding style and it’s “convention over configuration” started looking awkward to me. Because I had jumped into CakePHP from a comparatively liberal world of programming, CodeIgniter. I learned CakePHP for a couple of months, even used it in a few applications I was working on that time and I gave it up. It was painful for me.

But then, I realized that to write code that you can really take pride on, you must follow the convention. You can’t simply write business logic inside a controller just because you can do it. You should give up your stubbornness. I started again with Zend Framework. We, a small team in leevio spent a couple of weeks learning Zend Framework together. Though it was a bit painful that time with Rob Allen’s tutorial and very very bad official manual where anyone gets lost in a pile of unnecessary talks, ultimately it started paying off. We learned the ZF and helped other people in our team to learn it in a collaborative effort. Zend Framework is a real gem. It’s strict, but it allows you to write bad code too. However, the strictness is not something that can hurt like a framework which I frequently call a configuration junky, like symfony.

I had a hell of an experience with symfony, oh boy! I wanted to give it a try in 2007/08 and then after spending two days with their configuration system, sandbox, blah blah, this and that, i had been finally able to say hello to this world. I was exhausted, my eyes were almost tearing and it didn’t take much time to change my “hello world” into “bye bye symfony” 😛

Long story short, if you are a beginner with MVC and want to learn a framework from the heart, start with Zend Framework or CakePHP. Soon you will realize that you may not have to move or use any other framework unless the situation requires it. Saying that, there are other very good frameworks out there like Yii, CodeIgniter and Kohana (started as a fork of CodeIgniter and later it became what it is now)

And again I am answering the title question “Which frameworks is best” – there is no such “best” thing to be honest. The one that suits your need is the best framework for you.