Feb 23

cakephp.gifAfter literally weeks of tenuous back and forth rhetoric with myself (internally) and my fellow co-workers, I have finally, humbly, and assuredly concluded that CakePHP is the best PHP Web Framework in the world!

I could argue the benefits of Cake vs. other Frameworks again, but I’ve already done that, twice (though I originally decided differently).

Instead I’m hoping to help the Cake community a bit today. I’m not a “Cake expert” yet, but I think I can contribute a few things that can possibly ease some of the few frustrations that might occur when getting started with Cake.

Dustin’s CakePHP Beginner’s Guide!

I’m gonna try and keep it simple (K.I.S.S.) for ya’ll and do my best to actually offer any Cake newbies out there some advice that can help get the ball rolling quicker.

After showing it off to my co-workers and going through the manual a few times, here’s my

reccommended approach to the learning process:

First, Some Installation Tips:

- Use Apache… it’s just easier than IIS and it’s time to make the switch if you haven’t yet. Make sure mod_rewrite is enabled; again to make things easier.
- If you must use IIS, check out my writeup to help you get the ball rolling.
- “Make sure that an .htaccess override is allowed in your
httpd.conf (Apache), you should have a section that defines a section for
each Directory on your server. Make sure the
AllowOverride is set to All for the
correct Directory.”
- Don’t mess with the production install of Cake yet; just do a development setup.


Second, do the basic blog tutorial:

- Prepare for the inner excitement that will soon come.
- I know it’s not the recommended order of learning, but I think it works better to give a real-world example right off the bat before anything else.

Third, save that blog code and start working your way through the manual:

- Start at the very beginning, don’t skip any sections, and read every word.
- When you get confused (which you probably won’t much), re-read!
- It’s not a big manual, you’ll be done in an hour or two.


Fourth, go watch a few of the screencasts:

- Especially: Building The Bakery & Admin Routing

Last, start your own basic project and see where you get.

Here’s a few more helpful tips:

- Explore the Bakery for cool stuff.
- Get the ‘Cakesheet‘, it can save some serious searching time.
- Use the Cake Google Group, en excellent option for help.
- Remember to search through the User Manual, API, the web (2.1 million results for Cakephp on Google), and the entire Google Group BEFORE asking a question. You’d be surprised how often I see thread’s on the group posted that look something like: “Cake N3wbie – How do I connect to a database”. I know it’s easy to just ask and be lazy, but trust me, there’s a really good chance it’s already been answered. Don’t wear out the Cake experts prematurely with the simple stuff.

Ok, now you have enough to get started, so why are you still here reading this?

By the way: Let me know how Cake works out for you!

38 Responses to “Getting Started With CakePHP: No Frustration Permitted!”

  1. Anonymous Says:

    I've been baking with cake for about a year – and after getting my head around some of the model/array stuff – things are flying along very well.
    I did bump into QCodo though and it has be wondering what it would have been like (but I just don't have the time to re-learn).
    Did you ever try QCodo out? It looks like it takes the best parts of ActiveRecord, MVC, and .NET-like event-driven components, and puts them together really well.
    It generates true ActiveRecord objects (not the awkward data arrays that cakePHP works with) and has some really nice looking GUI widgets.

  2. Dustin Weber Says:

    Yeah, I tried QCodo, but I have some apprehensions about it’s long term viability (basically it doesn’t seem to have as active of a community as Cake – for example: Google returns only 194,000 results for Qcodo… while CakePHP returns more than 2.1 million.
    I do agree though, it has some strong-points.
    Honestly though, I spent literally hour upon hour reading reviews, trying out, and reading manuals… and Cake seems to be the best overall package. Also, in it’s true form, it still relies on basic PHP stuff that our team at work (including myself) can easily switch into (and convert older application efficiently too).
    I would love to know if you have any beginner tips that you might have fellow Baker’s though!
    - Dustin Weber

  3. Anonymous Says:

    Hello Dustin.
    It was nice to go through your quick guide to start with Cake. I would just like to add a point. For me, the best thing about Cake is that it allows you to quickly get going with a project. Features like scaffolding and baking gives a good starting point for the project to roll.
    Another useful feature being the quick implementation of Ajax using the ajax helper. Here's a collection of useful links I found to get started with Ajax in Cake, link

  4. Dustin Weber Says:

    I totally agree.. the scaffolding and baking process is an extremely powerful part of Cake that I think many people underestimate.
    Thanks for the links, they were actually pretty helpful.
    - Dustin Weber

  5. Anonymous Says:

    It's not a big manual, you'll be done in an hour or two.

    Yeeeeeah, that's kinda Cake's biggest problem for me. I'd like a big manual, or at least a complete one. I've been working with CakePHP for a few months off and on and still frequently find myself googling around hoping that somebody else has posted the answer I need. The most recent example was, well, just today, using the “dateTimeOptionTag” command. Neat, yes, but only documented in the API — and try finding anything on CakePHP's site that lets you know you need to run 'cleanUpFields' on the returned data.
    There are a lot of cool things about Cake, but I hope after Cake 1.2 is released, there's going to be a serious effort into getting the documentation up to speed. There's a lot–no, a whole frickin' lot–that isn't covered in the manual or the blog tutorial, and to add to the frustration, information that apparently used to be in the wiki is gone now (I get dead links to it fairly frequently on searches).

  6. Dustin Weber Says:

    But I think the manual wasn’t really meant to be the end all/be all resource for everything. It’s supposed to be the basics and examples of what you can do and generally how to do it.
    Once you know the basics, you start using the API, Bakery, and other resources on the web. We are programmers, so at some point the hand-holding has to drop off a bit.
    Regardless, I agree, a revamp of the documentation could be helpful. I am hoping to contribute in that regard as I grow my knowledge of Cake. I’m willing to kick in and help where/when I can.
    I’m starting the process by documenting my trials here on this blog such that I can start getting feedback on what I think/know about Cake.
    Hopefully, with some time, we can all help provide the documentation and support Cake needs.
    - Dustin Weber

  7. Anonymous Says:

    I have gone through all of your posts and it is nice tor read your comparision of Cake/Symphony/Zend but why have you not tried CodeIgniter? I am very new to PHP and looking for a framework for my application and I have heard very good about CodeIgniter. But I would like to know why you have not given it a chance?

  8. Dustin Weber Says:

    Honestly,
    I did ‘glance at it’, but I did a quick Google search for CodeIgniter and was not impressed with the results. I’ve always felt that the number of results on Google for a particular search term is a good indicator of the popularity of that item.
    Currently:
    CodeIgniter has about 545,000 results.
    CakePHP has about 3,980,000 results.
    That tells me a lot. Plus, the amount that number grows over time is a good indicator of popularity.
    On February 23rd, I found that CakePHP had around 2.1 million results. So, in about three months, the number of results on Google for ‘CakePHP’ have more than doubled.
    That’s a really good sign in my humble opinion.
    - Dustin Weber

  9. Honestly Says:

    If CakePHP had good documentation, there wouldn’t be nearly as many Google hits for sites like this one. I’m here trying to figure out why cleanUpFields isn’t working. For all I know, 2 million of those cakephp hits are because Cake is good, but its documentation blows, and there’s a lot of people trying to figure out what the hell is going on, like me!

  10. Dustin Weber Says:

    @ Honestly

    I don’t get it personally. I’ve had no problems with the documentation. The manual is a good basic starter (when you need your hand held) and the api pretty much helps with everything else.

    Other than that, the countless sites like mine out there can help you solve almost anything else.

    What problem are you having with cleanUpFields?

    - Dustin Weber

  11. Graham Says:

    Dustin – No regrets? Is Cake still better than Symfony? I’m doing this evaluation now and leaning towards Cake.

  12. Dustin Weber Says:

    @Graham

    No regrets what-so-ever. CakePHP is the way to go. I’ve had much success and it’s only gonna get better with the up-and-coming release of version 1.2

    I think you’ll find the small overhead of learning the framework is well worth it.

    - Dustin Weber

  13. Rihad Says:

    Good luck with your articles! Personally I don’t like Cake’s code: it doesn’t give me an impression of a professionally written system compared to Symfony, so I withdrew. True, Symfony’s form handling/validation techniques are *awful*, not to mention its use of the grotesque Propel, but things regarding forms are about to improve in 1.1 (ETA end of August) or 2.0 where both Propel and Doctrine will be supported.

  14. Dan Cort » Blog Archive » Aprendendo CakePHP Says:

    [...] não existe apenas o CakePHP, tem também o Zend, Symfony e outros. Eu escolhi o Cake depois de ler esse post que foi bastante convincente para mim. Nem tentei esses outros [...]

  15. Hans.J Says:

    @Dustin Weber: You should have a look to the Akelos PHP Framework and you’ll finally understand why Rails has such a hype. They really ported most featured from Rails even ERB view syntax.

    Akelos really beats Cake and CodeIgniter. Just watch their video and the judge yourself, can you do that on Cake or Symphony in such a natural way?

    Akelos is the most promising framework I’ve ever tried and I knew about it after I Digged this comparison, plus it worked out of the box for creating pages in several languages (managing German and English Cake sites was no fun at all compared to Akelos)

    Their community is getting bigger and is preparing a Radiant CMS port to PHP named Editam, IMHO the killer CMS developers were waiting for, a sort of 37signals interface with Drupals modularity and Akelos MVC.

    After trying it you might reconsider posting a new YABPFP (Yet Another Best PHP Framework Post) :D

  16. Posting_From_Cali Says:

    @Dustin

    Before I begin: Thank you for your great blog posts and write ups.

    Q. Which do you feel would be the ideal framework for creating ‘one’ large web application long term – as opposed to creating several smaller applications short term and doing so very rapidly?

    The concern is performance, extendability and scalability.

    Thank you so kindly.

  17. Dustin Weber Says:

    @ Posting_From_Cali

    I think CakePHP is an excellent choice for this. It all depends on what you want to do with the web app though. I mean, if you are creating a blog then something like WordPress might be better. A huge CMS, perhaps joomla or mambo.

    But a highly customized web app, Cake takes the “cake”, at least in my opinion.

    - Dustin Weber

  18. Rob Nugen Says:

    HI Dustin

    I appreciate your depth of research on Cake, and wanting to update the documentation.

    I dunno if you are *still* interested (as your last comment here was 4 months ago), but I have just taken meticulous notes as I installed Cake for the first time on my server.

    The notes, and installation are here:
    http://php.robnugen.com/cake_2008feb22,_1.1.19.6305/

  19. Dan Says:

    I’m gearing towards CakePHP while browsing ZendF. Zend is ALOT scarier for a n00b. Although i’m not a n00b, I found reading the cakePHP manual vs the zendf manual was much easier. What’s the point of a manual of it does not “build” on previous chapters. There’s just too many things to learn in zend. It is powerful and they both have the many similarities i care about. I read the 1.2 manual, haven’t read the 1.1 yet. (nor I want to/will)

    But My 1 comment to you is why do you go with google results as an indicator when at some point ( I assume) another framework had more hits than CakePHP.

    Who knows how many other “cakes” are out there. With your logic the “rich get richer.” Personally I created my own framework out of frustration of learning all these frameworks and months comparing and contrasting. So I decided to choose a small web app with each one. I’m starting with CakePHP, let’s see how it sets the pace for Symphony and ZendF.

    Thanks for the article,

    Dan

  20. David Kelly Says:

    more != better

    For all you know the reason there are more hits on Google for Cake than other frameworks is because more people have to ask questions on blogs like this one for answers they can’t find in Cake’s documentation. I wouldn’t take Google hits as an indication of quality.

  21. Alex Says:

    Hello,

    I am using easyphp (apache 1.3, php 4.3.1), I tried installing cakephp many time but could not.
    There are many articles but none provides detailed instructions on how to install cakephp and how to test/check that it has been installed properly.
    Second problem, developers usually work on more than 1 applications at a time, how to setup cakephp once and use it with all applications?

    Thanks.

  22. Dustin Weber Says:

    EVERYONE

    This post is very old at this point. CakePHP has changed immensely since I wrote this article and things have gotten much much better. I would recommend you learn version 1.2 (it is in RC2) and you’ll get to learn the best php framework by far.

    Thanks,

    Dustin Weber

  23. aaryan Says:

    hi, this aaryan, i want to know which framework is better to learn, i got zend IDE is good, and i am learning Cakephp, i am confused, zend has framework its own and IDE, then why should i use Cakephp, it is little bit confusing while using…

    Will u plz suggest me any site which gives more help on the basics of baking cake…

    Advance thanks for your articles…..

  24. Genu Says:

    @ aaryan
    zend framework doesn’t really have its own IDE. Zend studio is the IDE, and zend framework is just another product of zend.

    Also, the “CleanUpFields” function mentioned earliler was removed from cakePHP 1.2 (I believe)

    I would suggest going through the IBM CakePHP tutorial to start with. It has about 5 or 6 parts to it, with 7 pages each. It covers very useful information.

  25. wil Says:

    I have tried cake before but I did not like the way code was generated when scaffolding. I think Symfony approach is neater. Needless to say I have been now using Symfony for quite some long and I am very happy with it.
    Now I am planning to migrate to version 1.2 which uses Doctrine as a ORM (much more powerful than Propel, IMHO) and explodes most of the latest features of PHP in regards with OOP.
    Anyway, I think it is hard to determine which one is the best since both are great and are changing and new features are being added constantly, so I say, good for you if cake fulfills your expectations and good for me because, I have found a greay MVC PHP framework. Either ways, MVC concept rocks! Have fun guys!

  26. links for 2009-04-04 on studiowhiz.com Says:

    [...] Getting Started With CakePHP: No Frustration Permitted! | The Weber Report Great collection of links for those starting out with Cake PHP (tags: cakephp php tutorial framework programming webdev howto learning reference mvc) [...]

  27. Johan Hultin Says:

    Hey Dustin. Thanks for the tips, I’ve just started, well I have yet to get that far into things, with cakePHP, truth be told i find it quite a mind twister to get my headaroung, might be due to me being new to PHP (more of a .net guy originaly) but i’d guess it is due to it being so diffrent from anything else i’ve worked with previously.

    I would, if you don’t mind, love a few real tutorials so to speak, ergo step by step instructions, as i find that cakephp’s offical documentation is kind of messy and insufficent on HOW to get started and what goes where.

    Regards, Johan Hultin

  28. Atea Webdevelopment Says:

    This is very helpfull, thank you!

  29. Homeless Says:

    >CodeIgniter has about 545,000 results.
    >CakePHP has about 3,980,000 results.

    Uhmm, do you like stats ?

    So 40 million of flies eat ship … they must not be wrong.

  30. Homeless Says:

    Sorry …

    So 40 million of flies eat shit … they must not be wrong.

  31. johnny Says:

    PLEASE PLEASE comment on Smarty…

    I have had some developers build my site using this and I don’t know whether I wasted a tonne of money… I am scared and don’t know whether I should have done more research on Cake, Symfony………

    DAZED AND CONFUSED!

  32. martin Says:

    Hi,

    I read following link.
    http://cookphp.blogspot.com/2009/09/cakephp-for-beginners.html

    I think I am getting right but it is giving me warning that tmp directory is now writable. Can anyone help me please

  33. Marlon Says:

    Homeless,
    If you start taking ratio’s into consideration, flies vs humans, then your little hissy fit does not make sense any more, does it?

    I have settled on CakePHP coming from CodeIgniter, I haven’t tried anything else, and I don’t think I will.

  34. abhishek Says:

    nice tutorial dude

  35. Chris Says:

    @homeless – a bit of respect would go down nicely here – dont forget you are reading some else’s blog and of course their subjective opinon. I dont know why people think they a have a right to force people to their opinion?

    It is funny comming from a C | C++ background (1994) because all the same arguments were used back then!

    I remember people laughing that we used VCL (Borland C++ Builder) over MFC (Visual Studio) – what a happend? MS head hunted the original designer of VCL (delphi) and he designed .NET!

    You dont hear that many people banging on about MFC anymore! If you do, just tell them composition | aggregation beats (purely) inheritance.

    Dustin – if you read my last comment from the Symphony posting..

    “Phew, looks like the Cake stuff over the week end was okay then!”

  36. Getting Started With CakePHP: No Frustration Permitted! | The … | Velocity Software Solutions (P) Ltd. Says:

    [...] programming webdev howto learning reference mvc) Johan Hultin Says: …See original here: Getting Started With CakePHP: No Frustration Permitted! | The …Return to topTagged: cakephp-php, does-not, frustration, johan-hultin, php, point, the-point, [...]

  37. Adam Says:

    Thanks – some good info here for me to get back into Cake, its been a couple years, so needed a refresher.

    FYI — Google Search not at: 13,800,000

  38. zaty Says:

    thanks for sharing, im the newbie in cakephp development,
    nice tutorial babe !!!

Leave a Reply