, by Samisa Abeysinghe.
When I received and unpacked the book, it was a little lighter than I had expected, however REST really isn’t rocket science and can easily be covered in a tome this size. Overall it was well-written (with only as many spelling mistakes as any other PHP book) and clearly organised. The author begins by skating over why we don’t want to use SOAP, and shows his enthusiasm for REST as a replacement. However before the true elegance and concepts of REST are brought out and revered, we skip straight along and start to look at examples. Very few services that claim to be RESTful actually are, which makes writing anything along these lines very tricky, however I did feel the author could have been clearer about why having a single URL and a parameter for which action should be performed, doesn’t fit well. We do get a sense of excitement about services as ways to “glue together” bits of data on the net, and the possibilities of exposing and consuming information in this way.
Several frameworks are mentioned that can be used with REST, I’ve only heard of one (Zend Framework) – and this book works through a number of examples of working with Zend Framework to provide a REST service. The examples throughout are very thorough – starting with designing the service and getting the semantics of HTTP verbs sensibly applied. We are then taken through building the service using Zend Framework, creating a library class of functionality and then setting up the server to respond to incoming requests. For anyone using this book it is also worth checking for more up to date tutorials; Zend Framework has regular releases and some of the information in the book is already out of date – the dangers of the cutting edge!
On a personal level I’m not a big fan of frameworks; Zend Framework is a favourite but the use of it in this setting means that there is a large amount of the book dedicated to Zend Framework, the MVC pattern, and other things that aren’t really anything to do with REST. Call me old-fashioned but for me RESTful services need only HTTP and a data format of some kind, JSON or XML, and a good understanding of the grammar and structure of something that “smells” RESTful. In this book I got bogged down in the cookbook-style examples and lost sight of the bigger picture. The chapter summaries and best practice pointers though were great and I hope readers do take note of these.
If you need to build a RESTful service and you don’t mind Zend Framework, then this book will attempt to guide you through the process and explain plenty of useful stuff along the way. For a mid-level PHP programmer coming in to services for the first time, I consider this book a nice entry point. However if you were hoping to pick up the concepts behind RESTful services and look to apply them in your own work, then your $40 would be better spent on the RESTful Web Services from O’Reilly – you won’t be copying and pasting working PHP code, but you will come away with some great ideas.