Why I Don't like CakePHP

I’ve used CakePHP for a lot of projects now. Verdict: there’s no comparison to Ruby on Rails. Ruby on Rails is smartly integrated, well-designed, and sits on top of an elegant language. CakePHP is an admitted ripoff of Rails that sits on a popular but terrible language. It copies Rails – almost randomly – without copying any of the stuff that makes Rails great. PHP is a language plagued by indecision, delays, and paradigms from the last decade.

What makes Rails great?

  • An ActiveRecord implementation that isn’t brain-dead. The Object Relational Model is, you know, actually object-oriented.
  • Lazy-loading of records that allows as-needed fetching of model associations instead of a dumb and unintuitive $recursive variable.
  • Actual documentation that doesn’t suck (not that it didn’t suck in the early years). Cake’s has been getting better lately, but it’s still got a long way to go.
  • Massive community of great plugins.

What makes CakePHP awful?

  • Arbitrary and seemingly random nesting of HTTP input parameters. It gets to the point where I sometimes access $_GET and $_POST directly, and just carefully sanitize the data myself.
  • Default routing does not use REST, and is difficult (but not impossible) to coerce into anything resembling REST.
  • Model instances are represented as PHP arrays instead of objects. So it’s like a struct, except uglier, and you can basically set a few class variables on the model, then call a class method, which simulates an object method. Nice. The CakePHP core team’s position on this is that it is made this way so users cannot call instance methods in the view. So not only is the decision based on stupid reasoning, it’s not even a technical one.
  • Ridiculous schema manager that has noble intentions, but tries to automate too much. Instead of making you write your own schema changes like Rails does, it tries to figure it out on its own — with disastrous results. Let’s say you rename a column and want to port that change over to another database using the cake console. Instead of renaming, it will drop the column and make a new one, which means — yes — all your column data is now gone. This is because there’s no way to tell with certainty the difference between a rename and a drop/add after it has already happened. But it matters.

One thing I definitely get the sense of is that Cake doesn’t even try to hide the fact that its cloning Rails in PHP, but it’s at a disadvantage from the start because PHP’s syntax is just so much worse. And they use arrays to represent objects. And PHP’s array syntax is terrible. Unbelievably terrible.

I spend the majority of my time in Cake trying to manipulate arrays-of-arrays-of-arrays-of-arrays that are supposed to represent some kind of shoddy struct, then mangling with model associations that require about 5 nested arrays to define. Add to this the fact that CakePHP tries to “innovate” its way around some of its shortcomings in a less-than-brilliant way (like, um, $recursive) and you get a steaming pile of garbage that’s only marginally better than just coding a PHP project from scratch.

Rails’s smart design has come at a cost. In the past, they haven’t been shy about breaking backwards compatibility, sometimes in a big way, to cut out cancerous ideas before they take hold. It’s a community that acknowledges mistakes and embraces their eradication. And Ruby is an elegant language with strong design and is under active development. PHP on the other hand has languished for years, most notably with a critical security bug called $register_globals. On top of that, they’ve been slow to introduce object support, type-checking, and sometimes make terribly confusing decisions (like the decision to call a feature overloading that has absolutely nothing to do with method overloading in the traditionally accepted sense of the word).

To be fair, here’s what I don’t like about Rails (and Ruby):

  • Massive list of reserved variable names, which of course will throw a cryptic and seemingly unrelated error if you use them.
  • Concise syntax that sometimes resembles perl. Yes, perl. It’s that bad.
  • Bizarre decision to use “end” to close blocks instead of something sensible, like um, anything else. More typing for no good reason. The cherry on top that makes this not OK is that while its illegal to define a variable named “end,” its fine to define a function named “end.”


21 comments to “Why I Don't like CakePHP”

You can leave a reply or Trackback this post.
  1. Steven P - April 14, 2013 Reply

    cakePHP sucks. Why? Their own blog tutorial – ambiguously written – results invariably in error messages:

    Error: PostsController could not be found.
    Error: Create the class PostsController below in file: appcontrollersPostsController.php

    If those idiots cannot write out a simple “hello world” tutorial … one wonders what else they punted on.

    PHP is an old, old friend. codeigniter is not, but at least it works out of the box and is documented by humans rather than imbeciles.

  2. Ged - June 5, 2013 Reply

    Cake php sucks. Still asking why? Their examples are difficult to understand. They have 15 minute tutorial but setting up instruction will take you a day and you will realize that their instructions are not that helpful.

  3. Per Thykjaer Jensen - August 16, 2013 Reply

    With CakePHP you sooner or later arrive at some undocumented dead end where nothing works, and nobody can tell why. It is in my oppinion a complete waste of your time.

  4. lawaclatrik - November 13, 2013 Reply

    Someone say’s that cakePHP is a ROR clone. Hmmm… I would see where there is a ROR style in this piece of shit !

  5. Jules - November 17, 2013 Reply

    I spent a long time working with CakePHP. I spent more time fighting with it than getting benefit out if it.

  6. Kishor - July 31, 2014 Reply

    Hi Peter, how are you.
    Can you help me in building a recipe website.
    have you seen the website tastespotting.com, foodpair.com
    I really like the pattern n formats instead of the regular stuff and then use the header in two lines for the rest of categories.

    Just a heads up
    I looking frwd to a website and mobile app for all OS n tab with
    Compulsory registration which cld be possible from all possible social networking sites Users should be able to register any how in any which way possible, by a standard email process OR through social networking sites like FACEBOOK TWITTER LINKEDiN PINTEREST and all such sites also if possible Registration through mobile phone shld be made available.
    Mobile Apps shld not have much of a difference than the main site.

    International Payment Gateway shld be user friendly with emphasis on internet banking and any visa master or gift n all possible debit cards and could be added n if IMPS like Mpesa can be added.

    The Recipe Management and Socializing Application shld allow registered users to view unique recipes of other individuals who are passionate about cooking.

    HOWEVER the recipe management application shld only allow cooking enthusiasts to share edit existing recipes and repost and promote recipes by email they would like others to prepare and enjoy with their friend and families – ONLY if they make specific payments.


    • Peter Cai - August 9, 2014 Reply

      Kishor – sorry, I don’t consult on projects like this and I don’t freelance. Your best bet would be to flesh out your idea into a detailed specification and go somewhere like freelancer.com to submit an RFP for bids. The most difficult thing here is to have a thoroughly complete and unambiguous spec so that there’s no wiggle room for the developer to technically meet your requirements without actually giving you what you want. This is actually really hard.

      Or if you’re trying to do it yourself, your best chance of success is finding a platform like WordPress, Drupal, or Magento that you can bolt your functionality onto. I am not sure what your experience level or approach is, so I can’t be much more specific than that.

  7. ankit - June 20, 2016 Reply

    Cakephp is awesome, if any issues contact me.

    • Johnny - December 9, 2016 Reply


      When I run the command, “cake bake”, why does it not go into the cake shell? It runs it, then I’m back to the dos prompt?

  8. Johnny - December 9, 2016 Reply

    cakephp is a piece of shit, maybe? I dunno , can’t get the f****ing shit to work properly to actually assess it. All the tutorials are out of date.

  9. Ray - February 14, 2017 Reply

    This article is 7 years old now and where is Ruby? Nowhere to be found. And where is PHP? Everywhere. Good luck finding a job coding in Ruby or even Python. You’d be better off learning ColdFusion. LOL

    • pcai - February 23, 2017 Reply

      I’m not sure what point you are trying to make? There are a lot of things you could criticize this ancient post for (and you could’ve easily sounded smart, since you are talking to someone in 2010), and I would’ve wholeheartedly agreed with you on. But PHP was a garbage language 7 years ago, and CakePHP was always a garbage framework. Nevertheless, this wasn’t a prediction of doom for PHP. For what its worth, I’m gainfully employed at a Ruby startup today, and doing talks in the local Ruby community.

      But if you’re going to make random unfounded claims, PHP has been on a long slow decline for more than a decade:

      • Lee - May 6, 2017 Reply

        Hello, can I know where I can find those statistics of interest from? Thanks

  10. Anti-Indian - May 25, 2017 Reply

    If someone says CakePHP is great, he is a piece of shit.

    • pcai - July 5, 2017 Reply

      I removed your other comment because it was a racist piece of garbage. I approved this one because it was merely garbage.

  11. Josh - April 24, 2018 Reply

    I agree. CakePHP is just a shitty framework!

    – it is monolithic, absolutely **not born to be scalable**. Pretty funny when your app starts having billions of hits and you’re forced to buy custom private clouds to run something that could be done by a single php page.
    – it’s **incredibly slow**. Recent versions of Cake are still the slowest frameworks I’ve ever tried compared to almost any other framework.
    – it has **tons of lines of code**. Some developers don’t care what’s going on under the hood; I like to be able to quickly find out how/why something doesn’t work the way it should. But it’s code is so much that finding a glitch can be overwhelming.
    – it has a **ridiculous namespace organization**. It implements lazy loading in the form of App::uses. This is, IMO, clumsy and no better than doing a require.
    – it has a totally **inadequate documentation** leaking in every aspect, not even approachable as a real documentation. It looks more like a cut&paste archive of Pastebin (http://pastebin.com/). So finding something on the documentation becomes a nightmare, while it should help you saving your time.
    – it **does not support default routes** for fancy/custom urls unlike ANY other php framework. So while crating urls, you are required to update the default routes. This sounds a bit ridiculous in modern web application development.
    – **migrating from version 2.x to 3.x of CakePHP** it’s a complete nightmare and nearly impossible to do in most of the cases. Pretty insane for a self-defining backward compatible framework…
    I could keep on writing an endless list of horrific things about it; it’s enough to say that IMO **it is the slowest, most confused, and worst framework I’ve ever used in 27 years of professional development**.
    **People should delete it from the Internet** instead of magnifying it just because it makes possible to build insecure and bad-performing apps to noobs and totally incompetents. Not to mention self-defined programmers whom could not write a framework in an entire lifetime.

  12. Peter Rawdy - October 31, 2018 Reply

    Why don’t you use Nette? https://nette.org/

  13. Guster - March 2, 2019 Reply

    Google Trends brother

  14. Support Team - July 19, 2019 Reply

    Use zend

  15. Support Team - July 19, 2019 Reply

    Why don’t you use zend?

  16. Jorge - May 26, 2021 Reply

    While looking for another issue, I randomly arrived at this post.

    CakePHP has improved a lot in the recent years, with a massive effort in documentation, improvements in performance and support for modern standards and best practices. You may like it or not and that’s totally fine of course, but I’m sure if you approach it today, and follow any of the tutorials https://book.cakephp.org/4/en/tutorials-and-examples.html , videos in youtube https://www.youtube.com/cakephp or attend to one of the training sessions we do every month, you’ll be surprised.


Leave a Reply

Your email address will not be published.