RESTful PHP Web Services

RESTful PHP Web Services
eBook: $23.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 40%!
Print + free eBook + free PacktLib access to the book: $63.98    Print cover: $39.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Get familiar with REST principles
  • Learn how to design and implement PHP web services with REST
  • Real-world examples, with services and client PHP code snippets
  • Introduces tools and frameworks that can be used when developing RESTful PHP applications

Book Details

Language : English
Paperback : 220 pages [ 235mm x 191mm ]
Release Date : October 2008
ISBN : 1847195520
ISBN 13 : 9781847195524
Author(s) : Samisa Abeysinghe
Topics and Technologies : All Books, Web Development, Architecture & Analysis, Open Source, PHP, Web Development

Table of Contents

Chapter 1: Introduction to REST
Chapter 2: REST with PHP—A First Look
Chapter 3: REST in the Real World
Chapter 4: Resource-Oriented Services
Chapter 5: Resource-Oriented Clients
Chapter 6: Resource-Oriented Clients and Services with Zend Framework
Chapter 7: Debugging REST Web Services
Appendix A: WSO2 Web Services Framework for PHP
Appendix B: RESTClient class
  • Chapter 1: Introduction to REST
    • Programmable Web
    • HTTP and Web Services
    • What is REST?
    • HTTP Methods
    • The Need for RESTful Web Services
    • REST Tools and Frameworks in PHP
      • XML Parsers
      • Tools for Accessing Services
      • Providing Services
      • PHP REST Frameworks
        • Tonic
        • Konstrukt
        • Zend Framework
        • WSO2 WSF/PHP
        • Madeam
        • dbscript
        • What Framework to Use
    • Summary
  • Chapter 2: REST with PHP—A First Look
    • HTTP with PHP
      • CURL
        • HTTP GET
        • HTTP POST
        • HTTP PUT
        • HTTP DELETE
    • Building the Request with XML Tools
      • SimpleXML
      • DOM
    • Processing the Response
      • SimpleXML
      • DOM
    • Consuming Flickr
      • Photo Search
      • Photo Search with Information
    • Summary
  • Chapter 3: REST in the Real World
    • Types of Services Available
    • Consuming Real-World Services
      • Cresting our Utility Code—RESTUtil.php
      • Consuming an RSS Feed—BBC News Feed
      • BBC News Feed with Yahoo News Search
      • Yahoo Maps and Local Search
      • Earthquakes and Yahoo Maps
    • Mashups
    • Summary
  • Chapter 4: Resource-Oriented Services
    • Designing Services
    • Simplified Library System
      • Resource Design
        • PUT vs POST
        • URI Design
        • URI and HTTP Verb Mapping
    • System Implementation
      • Library Database
      • Web Page from Data
      • Retrieve Operation
      • Create Operation
      • Handling Multiple Path Parameters
    • Summary
  • Chapter 5: Resource-Oriented Clients
    • Designing Clients
    • Resource Design
    • System Implementation
      • Retrieving Resource Information
      • Creating Resources
      • Deleting Resources
      • Putting it All Together
      • Implementing a Form-based Application
    • Summary
  • Chapter 6: Resource-Oriented Clients and Services with Zend Framework
    • Installing Zend Framework
    • Services with Zend_Rest_Server
    • Clients with Zend_Rest_Client
    • Library System with Zend REST classes
      • Library Service
        • Controllers for Book and Member Resources
        • Models for Book and Member Resources
        • Application Configuration and Initialization
        • Book Controller
        • Member Controller
      • Library Clients
        • List Books with GET
        • Add a Book with POST
        • List Members with GET
        • Add a Member with POST
        • Complete Client Application Controller
    • Summary
  • Appendix B: RESTClient class
    • get Method
    • post Method
    • put Method
    • delete Method
    • Complete RESTClient Class
    • get Example
    • post Example
    • Yahoo Search Client Example
    • Summary

Samisa Abeysinghe

Samisa Abeysinghe is Director, Engineering at WSO2. Samisa pioneered the Apache Axis2/C effort and architected the core of the Apache Axis2/C Web services engine. He continues to be an active contributor in the Apache Axis2/C project. His involvement in open-source projects began in 2004 when he started working with the Apache Axis C/C++ project.

Prior to his current role, Samisa played the project lead role for the WSO2 Web services Framework for PHP project, which provides comprehensive support for building both SOAP and REST services and clients.

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


- 2 submitted: last submission 28 Feb 2014

Errata type: Technical

According to the the latest manual here:, the CURLOPT_GET option is now changed to CURLOPT_HTTPGET.

Page no: 24 | Errata type: Code

 The given code is:
$url = "";
$result = file_get_contents($url);
echo $result;


It should be
$url = "";
$result = file_get_contents($url);
echo $result;

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

RESTful PHP Web Services +    IBM Lotus Notes and Domino 8.5.1 =
50% Off
the second eBook
Price for both: ₨332.60

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Basic concepts of REST architecture
  • Consuming public REST-style services from your PHP applications
  • Consuming RESTful web services, such as those from leading APIs such as Flickr, and Yahoo Web Search
  • Making your own PHP applications accessible to other applications through a RESTful API
  • REST support in the popular Zend framework
  • Debugging RESTful services and clients
  • A case study of designing a RESTful PHP service from the ground up, and designing clients to consume the service

In Detail

Representational State Transfer (REST) is a form of software architecture; systems that follow it are often called RESTful. It is the architectural style that drives the World Wide Web (the motivation for REST was to capture elements that made the Web successful), and RESTful web services use simple protocols already familiar to web developers. RESTful web services are found in lots of places with big name Web APIs such as Flickr, and Yahoo search following a REST-based approach.

With any architectural style or approach, struggling with its basic concepts is just one problem – implementation in your favorite language is another, and that's where this book comes in. If you're a PHP developer, this book will show you how to create and consume RESTful web services in PHP, and make your services work well in the context of the Web.

You will learn about the basic concepts of REST, and then look at PHP tools, libraries and techniques for working with RESTful web services. You will see how to use other RESTful services from your PHP applications, and also how to engineer your PHP applications to make them RESTful.

This book is about implementing RESTful web services in PHP, and so the book is packed with example code and careful explanations.

Learn the basic architectural concepts and step through examples of consuming and creating RESTful web services in PHP.


The book explains the basic concepts associated with the REST architectural style, but the emphasis is on creating PHP code for consuming and creating RESTful services in PHP. There is plenty of example PHP code to illustrate the concepts, with careful explanations of how the code works.

Who this book is for

This book targets PHP developers who want to build or make use of RESTful web services, or explore the options available to them in PHP. You will need to know the basics of PHP development, but no knowledge of REST is assumed, nor any knowledge of creating web services generally.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software