Review of RESTful PHP Web Services Book by Samisa Abeysinghe

I drank the REST Kool-Aid over a year ago and since then, I’ve been using the RESTful approach to building applications in Ruby on Rails. But I also have a significant amount of freelance work in PHP, and I haven’t fully explored applying REST in that language yet. So I jumped at the chance to get my hands on RESTful PHP Web Services by Samisa Abeysinghe, a new book from Packt Publishing.

Packt Publishing has only been publishing books since 2004, but they already have an impressive selection of titles. In the past year, I’ve purchased several of their books including Learning Drupal 6 Module Development and Learning jQuery, and can attest that the quality of these books is excellent, and their publications are often quite timely.

And the author is a key figure in the Apache Axis and WSO2 projects, so I suspected he probably knew what he was talking about.

The book assumes very little knowledge of any of the material it covers. If you have even the most basic familiarity with PHP, you will be able to follow this book. As I’ve come to expect from all REST learning materials, the first chapter is a whirlwind history of the Web and a review of the fundamental related technologies, including basic HTTP. Don’t know what AJAX or API stands for? Don’t worry, the author tells you!

I initially found this a little annoying for my own purposes, but I understand the necessity of this approach. I suspect that for many PHP programmers, and many younger Web developers in general, this type of review is helpful. If you are already familiar with REST, this chapter can be safely jumped over.

And after the first short chapter, the author quickly gets our hands dirty with genuinely useful code based on real-world applications. And this is the book’s strength: its the most comprehensively thorough technical book I’ve read in a long time. If you’ve ever been frustrated because an author doesn’t emphasize a small step in their instructions that turns out to be crucial to make the code work, you’ll appreciate the author’s thoroughness. Every detail of the code implementation is examined, and the author’s reasoning behind his decisions are all plainly laid out for the reader. Because of this, the author is able to provide more than just ‘demo’ code, while still making the progression through the book pretty gentle, so I think this book will appeal to a wide range of experience levels.

The author begins by using the CURL PHP API to consume popular Web Services like the Flickr API–again both instructive and useful. From this, the author really digs into the conceptual underpinnings of ‘resource orientation’. Then, after a brief survey of RESTful PHP frameworks, the author chooses the Zend Framwork for the remainder of the book, to create and consume your own RESTful Web Services, during which, the author explores design and coding best practices. (This includes an interesting approach to using path parameters in URL’s instead of query parameters.)

There is also a chapter devoted to debugging RESTful Web Services, which was nice to see, as this can be challenging. And in the appendix, the author gives a quick introduction to the WSO2 framework, a C PHP extension that can be used for both RESTful and SOAP Web Services.

By the end, you have a solid grounding in RESTful concepts, and an understanding of how to implement and consume RESTful Web Services, complete with best practices and reusable utility code.

And although the book consciously does not directly address applying REST to a full-fledged end-user application, it provides enough information to prepare the reader to make that step, including pointers to larger PHP REST frameworks designed specifically for those types of applications. So by the time you’ve finished the book, you will also have a good grasp of available RESTful tools in PHP and when you might want to use one over the others.

This is a small book, at under 200 pages, which might make you think twice about paying the $35.99 price tag. But this book is dense with information–it covers what it sets out to cover without fluff–so, given its quality, I think its worth it if you are interested in knowing how to apply REST to PHP. And if you’re like me, and configure print jobs to be 2 up and double-sided, then you can purchase the less expensive e-book version and print it out on a very portable 50 pages. (And then obviously, you can get the book immediately and have a searchable version of the content.)

Besides, according to the Packt site:

Packt believes in Open Source. When we sell a book written on an Open Source project, we pay a royalty directly to that project. As a result of purchasing one of our Open Source books, Packt will have given some of the money received to the Open Source project.

Related Post