CakePHP Application Development

3 comments | Posted: 11 January 09 in Books, by Yannick Lyn Fatt

CakePHP Application Development Back when I first started using PHP web frameworks, CakePHP was one of those touted as being the best and followed Ruby on Rails very closely. I decided to give it a try, however, I didn’t find it quite as easy as some had said it was. Add to that, the fact that the documentation wasn’t so great at the time either. It has certainly come a long way since then and is still regarded as one of the best PHP web application frameworks out there. I’ve been meaning to give it another try and since Packt Publishers was kind enough to send a review copy of CakePHP Application Development by Anupom Syam and Ahsanul Bari to us, it was the perfect time for me to revisit CakePHP and give it a second chance.

The book is really targeted at people just getting started with CakePHP. You can expect to get step by step instructions on using the framework and the “What just happened?” sections do a pretty good job of letting you know and understand why you did what you just did in the preceding steps.

As you might also expect from an introductory book on a web application framework, you’re taken through the basics of the MVC (Model-View-Controller) architecture, told how CakePHP makes building web applications faster and shown how to get CakePHP initially setup and working on your web server. Next you’re taken through the creation of a simple To Do list application. Models and Controllers are explained in more detail, in addition to relationships between database tables and helpers for your views.

CakePHP also comes with some shell scripts that can automate repetitive tasks so as to speed up development. Essentially you can generate Models from an existing database, as well as Controllers and Views with basic CRUD functionality for your application. Chapter 8 speaks to this and it was something that I didn’t know was possible with CakePHP. After going through the chapters up to this point and typing out the basic structure of Controllers, Models and Views over and over, you come to appreciate the automation made available by the shell scripts.

In the remaining chapters a sample application will be built called “Quick Wall”, a quick way to ask questions and give answers. This uses all that you’ve learnt thus far throughout the book and also demonstrates how to build in an authentication system, pagination, RSS, integrate AJAX functionality, and tidy up the application with a few extra helpers. I really liked the last few chapters as I know many times people learn the individual components of frameworks but have a hard time trying to fit the pieces together. The Quick Wall application did a good job of demonstrating how to do this.

All in all I would recommend this book to anyone just getting started with PHP web application frameworks and especially those wanting to learn CakePHP.

Discuss This Topic

  1. 1 Nate Klaiber

    I’ve been wanting to check this book out, too. I recently used CakePHP for a client application and regretted it very quickly. I still can’t get around the fact that the model returns nested arrays instead of objects – that doesn’t make sense to me. Did they mention reasoning for this in the book while explaining the framework?

    Regardless of my frustrations, I’d still like to check this book out. Thanks for the info :)

     
  2. 2 Yannick

    Hey Nate,

    I don’t recall the book explaining the reasoning behind the choice of nested arrays vs. objects. I’m assuming it’s because the framework is still trying to support PHP4 and from what I remember aren’t PHP4 objects not truly objects? I suppose you’d have to ask the developers what their reasons are for choosing nested arrays over objects. If you do find out the reason, I’d love to know.

     
  3. 3 Nate Klaiber

    Yannick,
    They could have still returned objects, it would have taken a little more work to support 4 (no method chaining across the objects).

    I have asked a few developers, with no real concrete response, just some proposed workarounds. I don’t see the workarounds as being efficient or maintainable in real-world scenarios.

    While Cake has several awesome developers working behind the scenes, you can’t expect to get real answers from Nate Abele. He instantly takes offense to any questions (seems to forget that the community is using it), and backs up and has a ‘I don’t have to work on this, Im doing you guys a favor’ mentality. That very much impedes getting real answers or discussions. Initially I liked the fact that he stood his ground, but over time I saw how arrogantly he handled questions – and it was a big turn-off for the framework itself. Too childish for my liking.

    I will keep hunting for the real reason. I have talked with developers. I have checked bugs/tickets (Where Nate quickly closes and dismisses it as not an issue).

     

Comments closed after 2 weeks.