Book Review: Easy PHP Websites with the Zend Framework

Several weeks ago (more than I’m willing to admit) Jason Gilmore asked approached me on Twitter and asked me if I’d be interested in reviewing his latest book, Easy PHP Websites with the Zend Framework. I was familiar with Jason’s publications on the PHPBuilder site and I had been itching to dive into the Zend Framework, so I jumped at the opportunity. It has taken me a while to get around to reviewing it, but I’m glad I did. Jason’s writing style makes challenging concepts easy to learn and his focus on good development practices are sure to inspire you to become a better developer. Here’s more detail on what I thought after reading the book…

By far, the most appealing aspect of the book for me is that it almost entirely revolves around a single, non-trivial, real web application (a social networking site called GameNomad). I agree with Jason when he says in the introduction that (and I’m paraphrasing a bit here) “stringing together a bunch of contrived examples is an approach which has become all too common in today's programming books.” Context is key, and a single reference application for nearly all the examples in the book provides excellent context. He uses the application to introduce (and occasionally go a little deeper into) many of the fundamental aspects of modern web application development that the Zend Framework helps with: managing and creating rich user interfaces, managing configuration data, creating web forms, interacting with a database, interacting with web services, and managing user accounts, to name some of them. Each of these areas is introduced at a high, somewhat theoretical level, but then quickly dives into examples that are taken directly from the GameNomad application.

The examples themselves are clear and well chosen. And, there is a line-by-line breakdown of each code example, so you come away with a solid understanding of what the code is doing. However, even though Jason holds your hand through the examples, don’t expect that simply reading through them is some sort of silver bullet for understanding the Zend Framework. The examples are a great introduction to what you can do with the Zend Framework, but (and Jason acknowledges this) they just scratch the surface. To really get the most out of the book, you’ll need to roll up your sleeves, try to implement his examples and extend them, and then crack open the source code for GameNomad and study the examples in the context of a real application. I think this is true of any book and/or framework. Frameworks aim to speed up development and lessen maintenance time in the long run, but to reap those benefits you have to pay the price of a learning curve in the short run. This book and the Zend Framework are no exception.

Note: Jason encourages comments and questions about the book, so you feel like you have an additional resource when the learning curve gets steep. I don’t know if/how he can scale to handle lots of questions/comments, but he was very responsive to mine. Granted, he knew I was planning to write a review.

Another aspect of the book that I found appealing is that it doesn’t only focus on the end product (an application).  It focuses heavily on the development process. Early in the book Jason says this: “After having been burned by yet another problematic bit of code, a few years ago I decided to step back from the laptop and take the time to learn how to develop software rather than merely write code.” Throughout the book, it’s clear that he walks that walk. He dives into (and repeatedly comes back to) many of the themes that separate developing software from merely writing code: the benefits of framework-driven development, the power of the model-view-controller (MVC) architecture, the importance of not repeating code (staying DRY), and the absolute necessity of addressing testing from the beginning. The fact that each chapter of the book finishes with a section about testing your work is testimony to the emphasis placed on the development process.

One suggestion here: I found it difficult to get the most out of the testing sections at the end of each chapter without skipping ahead to Chapter 11, which is an in-depth look at unit testing Zend Framework applications. I’d suggest reading that chapter early on – the testing sections in each chapter will make a lot more sense.

One area where I think the book struggles a bit is in nailing its audience. Jason states that, in order to get the most out of the book “…you should possess a basic understanding of the PHP language, at least a conceptual understanding of object-oriented programming and preferably PHP's particular implementation, and a basic grasp of Structured Query Language (SQL) syntax, in addition to fundamental relational database concepts such as datatypes and joins.” To me, that describes a beginner, but one who has some experience in at least playing with website development. However, the book includes an introduction to Javascript (something I would expect the target audience to be familiar with) AND an introduction to Doctrine 2 (something that seems beyond the target audience). At other points in the book, I felt that the transition from the basic to the complex was very fast (see my earlier point about needing to roll up your sleeves and dig into the examples). With that said, the book has something for everyone – you are certainly free to ignore sections that are old hat for you or that you are not yet ready to tackle.

Lastly, I’ll point out what I consider to be somewhat of a gap in the audience: PHP developers targeting Microsoft technologies. The book doesn’t ignore Microsoft technologies…in fact I think the book does a decent job of being platform agnostic – it addresses both Linux and Windows set up (although only Apache configuration is addressed, not IIS), it acknowledges Zend Framework support for many database and web service providers (SQL Server, Windows Azure, and Bing Maps included), and it even finishes with a Ruby-based deployment tool (Capistrano). But, with my focus on PHP-Microsoft interoperability (clearly, I’m biased), I would love to see things like the Windows Azure SDK for PHP, the SQL Server Reporting Services SDK for PHP, SQL Azure (pick any of the many topics I blog about) incorporated into examples in a book like this. (Hmmm…maybe I should ask Jason about working together to add a chapter…or maybe I should write my own book. :-))

Overall, I found this to be a very helpful book for understanding the Zend Framework and, perhaps more importantly, for understanding good development practices. If you are interested in other reviews of Easy PHP Websites with the Zend Framework, read Cal Evans' review here or Chris Hartjes review here. The book itself is available for download here:

Happy reading!


Share this on Twitter

No Comments