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” :P

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.

About these ads

38 thoughts on “Which framework is best?

  1. I believe when people ask which framework is the best, they un-knowingly wants to know the merits and demerits of the different frameworks available. Moreover, freshers or people like me(who knows jack about technology – I am being a bit modest here) would ask you a question like, “which framework is best” only to get started with something so that he/she can boast in the current company they are working at. Even more, freshers tend to ask questions like these because they want to know what is HOT out there. They would want to know the most contemporary framework available so that they can stay current, which is quite stupid anyways.

    Nevertheless, this is a good post Hasin bhai. You are the man, as always….paampotti marlam na….honestly.

  2. Btw I assume you are talking about “symfony” and not “symphony cms”. at any rate, Symfony2 is a totally different beast than symfony 1.x. There is still configuration, but its much more explicit and its released as stable and has all the features Zend Framework 2 is trying to implement already.

    • Sorry about the typo, and yes I was talking about Sensio Lab’s Symfony :) . Corrected.

      I will give the version 2 a try soon, sounds interesting.

    • I am with Lukas here, why you have to blaspheme on sf2.x because of your bad sf1.x experience? Please ensure that this blog post says sf1.x else you are misleading people who had not read the comments.

  3. “there is no such “best” thing to be honest.” – Absolutely. We may ask which framework may best suit with my requirements? Or which framework we can adopt well according to our dependencies. There isn’t anything called the Best in tech world. The parallelism theory is perfect in this case I guess :)

  4. Hasin Vai really awesome. this article is very much helpful for us who are still searching for a good php framework to learn. Thank You very much.

  5. “The one that suits your need is the best framework for you.” Add to this that you have to feel comfortable with the framework, and you’re spot on :)
    Note that feeling comfortable with a framework isn’t the same as a good (or bad) first impression. It takes a while to get into a framework and know its good and less good (or bad) sides.

    Btw, Kohana is nothing like a ‘fork from CodeIgniter’ anymore; it’s a completely different/new framework. And especially version 3.2 is great and not too hard to learn/get into.

    Also, check out symfony2 and see how it compares to your ‘hell of an experience’ with symfony1 :) I haven’t really worked with it yet, but it definitely looks great and powerful.

  6. why we will go to complex programming environment whether there is a simple solution like rubyonrails.org / another thing , for “non CSE” knowing about detail programming is so difficult , so is there any alternative easiest programming concept for beginner or for non CSE ?

    ““Ruby on Rails is a breakthrough in lowering the barriers of entry to programming.
    Powerful web applications that formerly might have taken weeks or months
    to develop can be produced in a matter of days.”
    -Tim O’Reilly, Founder of O’Reilly Media “

    • I dont understand but possibly Ruby community is the one suffering from huge superiority complex and (may be identity crisis, too?) – They publishes book like “Rails for PHP Devs” and “Ruby for PHP Devs” which is hilarious.

      Robin, this post is for PHP developers who are starting to learn a new framework and indecisive to choose one from the available frameworks.

      And this post is not for those who are actually searching “Which Language is Best” :)

  7. Great article as always. In case anyone decides to go the framework there is an excellent overview for PHP framework that I have found to be a great resource if someone going to be using framework for application development.

    Thanks Hasin Vai

  8. I’ve been working in Cakephp for 4 years now, has little secrets for me so it feels like home :-) Only bad thing I notice from time to time, you forget PHP and write your framework-code… Could be a dangerous sidenote when working als freelancer-consultant

  9. Ruby on Rails is great. It’s a very good thing to learn if you’re a PHP coder without MVC experience. Frameworks to PHP are (sort of) what Rails is to Ruby – it makes you organize your code.
    I remember giving up on Code Igniter because it supported PHP4, effectively ruining the whole object-oriented paradigm. Symfony has impressive features (hello there, profiler) and great tutorial; but I gave up on Symfony when I realized it wasn’t all that easy to learn – using relatively exotic languages (like YAML) and annotations (just… ugh), which seemed unnecessarily complicated. Zend Framework on the other hand is nicely structured and loose enough not to be the central problem in the application, but has a very poorly written Quickstart Tutorial, which needs a few days to complete, and not a few hours as it claims. CakePHP has a large “cookbook” database, but most of it is user-uploaded and poorly written.
    There is no “best ever” framework, it all depends on what you need. Don’t seek perfection, young grasshopper. Frameworks are like hammers; they all are made to bang on things, but come in various sizes and shapes, because you wouldn’t want to carve stone with a carpenter’s hammer.

  10. My story is very similar to your one. In 2001-2002 we were moving from ColdFusion and MS ASP (VB script) web solutions to PHP and/or JSP (Java). Our first experience with PHP MVC was the eocene framework (no more developed). Then we used CodeIgniter for couple of projects. We have also evaluated CakePHP and Symfony. My opinion is absolutly the same like yours. Nowadays we use only Zend framework and we are satisfied.

  11. Hmm…I don’t like restrictive frameworks, and I think one has to learn how to use MVC before saying something like “I put all my logic in my controllers because I could”.

    I like Codeigniter because it is fast, does not force you to structure your templates a certain way, has good helper functions, and has documentation that can’t be compared to.

    Zend is the messiest excuse for a framework I’ve ever seen, and CakePHP is huge and slow.

    I also feel that Codeigniter “locks you in” less than other frameworks.

  12. Hmm, when i was starting with php frameworks I found symfony(1.4) easier to get up and running than Zend. The company I work for runs on Zend. Personally I prefer Symfony- mainly bc of better documentation.Now I take only what components I need for a project, this usually ends up being a lot from symfony and a few from zend.

  13. My vote is for symfony too. I went through Zend, coming from Asp.Net and Asp.Net MVC, and I found symfony much easier to learn, debug, extend.

    A couple of months ago, I gave a try to Symfony2: lots of nice features, but not much documentation out there…

  14. “…it didn’t take much time to change my “hello world” into “bye bye symfony”

    My thoughts exactly, although for most major PHP frameworks. I had high hopes for Zend Framework in the early days, the code was clean, well designed and now it’s merely bloatware, with almost every class function accepting just about every type of parameter you could think of.

    From experience, the best route is to design and develop your own framework, it’s not difficult, it’s not -beep- rocket science for crying out aloud but I do understand why frameworks are somewhat popular… amongst designers and dare I say it, those pretenders who (are led to?) believe they are web developers.

    I’d like to see how many of those so called web developers actually sit down and design a framework on their own in 100% object orientation, nothing outlandish you know, just to cover the most common tasks.

    I’d hedge a bet most would fall down… badly.

  15. Hi there! I don’t want to argue, just to ask: do you really think that communication between View and Model should be avoided? As far as I know, it’s not considered as a bad practice. Honestly, I think you mean Model-Presenter-Controller architecture which is slightly different. OK, I must admitt also – I do avoid using Model directly in View, mostly just in case when I store some static data like variation of enums in Model_Const, but I would love to hear your opinion.

    • So you much prefer Ruby on Rails yes? The framework which doesn’t scale to meet demand as the number of users of an application increases? Is that the framework you much prefer huh?

      Why on this green Earth, the vast majority of websites are developed with PHP, is this language sucks.

      I suspect you are a) not mature enough, and b) lack enough real world experience to make any reasonable assessment as if you really were a professional you’d certainly have considered all options regards to a career path.

      PHP sits right up there, at the top kiddo.

  16. I’m using Play! Framework for Java… and I like it while I’m not fond too much in PHP, I’m using CI/Yii if there are projects requiring PHP

  17. I don’t think you really keep abreast of what’s happening in the PHP world today. Zend is notoriously tough to pick up and learn mainly owing to the really shitty documentation. If someone is just starting with frameworks, Fat-Free Framework is a very good choice IMO. Or the Silex microframework. These let you build your own systems on top of a slim and light layer which provides the essentials. Zend, more than a framework is a huge set of components somehow tied together. And for most projects, it’s overkill. BTW, CakePHP has reached release 2.0 which looks quite promising.

  18. nice post. from the beginning i love raw php coding. but some of my seniors said to learn about .Net, Asp.Net. they said, quality of php programming is low standard now a days. as php is little easier to learn, so non technical persons lead the field. .Net have much more advance logic. etc. now whats your opinoin, hasin vai?? i want to know the stability of php & .Net.

  19. For me Yii has been quite easy to learn and implement. Tried cakephp but yii seems much easier. anyways what ever framework you use, you must continually improve your core language skills in parallel. This helps to take the maximum advantage of the frame work that your using. :)

  20. i agree with you …. there is no tool best for every solution. Think what you have to develop first. I am liking Paul Dix idea of Service oriented design of an application. If anyone is try to build apps for fun an in a unconventional (or Amazon) way …. give his idea a try … there is lots of resources out there.

    I think a thin framework can help you in long run. Look at selix its the sinatra of PHP world. Building simple apps is long gone dream .. If you are not willing to use any framework use Selix or CodeIgniter.

  21. its old post but I found it now… but i will leave my comments anyway :)

    My usual answer to that is..
    We all can drive and have pleasure of driving different cars too. but at the end of the day, my car is MY car… there is no other car like it.
    why? because that is the one i paid for, i take care and it fulfill my urge of getting from one destination to another.
    Now consider framework as a car.
    What you can drive and fulfill your urge of finishing tasks, that is the best framework out there for you…

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