CakePHP Application Development

This review was originally printed in the September 2008 edition of the UKUUG newsletter, which is now defunct.

Title: CakePHP Application Development
Authors: Ahsanul Bari, Anupom Syam
ISBN: 9781847193896

For those who haven’t heard of CakePHP, it is an open source (MIT Licence) framework for building PHP applications. Frameworks appear to be, for better or worse, in vogue at the moment, and they promise to take care of all the boring repetitive code which is required for most applications, such as form generation, validation of user input and session handling. As someone who has written this sort of code time and time again, I’d be happy for any piece of software to take this tedious load away from me. However, the documentation for these frameworks is often best described as an API listing rather than an introduction to using the code, so hopefully this book will fill that gap.

Like most texts on frameworks, this book begins with a brief explanation of the Model View Controller (MVC) pattern. This is kept sufficiently short, and is described in a way which is clearly aimed at existing PHP developers, rather than generic software engineers – a major plus point for me. A short chapter follows on how to install Cake, which is once again to the point and thankfully doesn’t go into swathes of detail on how to configuring every possible web server which you might wish to run the software under (though tips on setting up Apache for Cake are included).

Following the quickest introduction and installation chapters I’ve seen for some time, the book launches straight into developing your first application. After a clear and concise explanation of Cake naming conventions – which is part of what enables the framework to automatically generate the bulk of your code – a simple todo list is up and running. The rest of the chapter runs through the basic operations – create, update and delete records – with data verification thrown in for good measure.

The next few chapters begin to delve deeper into Cake, but most of the sections are backed up by clear code examples which gradually build on what has gone before, and you can slowly see a complete book store management system begin to appear. Chapter 8 provides a solid overview of using the console to automatically generate Cake applications, saving even more typing. The final three chapters take you through the development of a more complicated application, which introduces user authentication, AJAX and other minor improvements such as search and RSS feeds.

Overall, this book is the best introduction to a PHP framework that I’ve seen so far. The only minor niggle I have is that it seems to stop abruptly at the end of chapter 12 – there is no concluding chapter with ideas for future projects, more in-depth resources to look at etc. – but heading to the CakePHP website (www.cakephp.org) will take you to the next step. If you want to get started with PHP frameworks, this is one of the books to look at – and a percentage of the price even goes to the CakePHP project.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.