0%

Book Description

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

  • 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

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.

Book Description

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

  • 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

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.

Table of Contents

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