Publication date : 01/15/2024

Course : REST architecture, developing Web Services in PHP

Practical course - 2d - 14h00 - Ref. STE
Price : 1340 € E.T.

REST architecture, developing Web Services in PHP




Web services conforming to the REST architecture style (also known as RESTful web services) establish interoperability between computers on the Internet. You'll learn how to implement a REST architecture, use HTTP protocol methods and implement a REST service using a PHP framework.


INTER
IN-HOUSE
CUSTOM

Practical course in person or remote class
Disponible en anglais, à la demande

Ref. STE
  2d - 14h00
1340 € E.T.




Web services conforming to the REST architecture style (also known as RESTful web services) establish interoperability between computers on the Internet. You'll learn how to implement a REST architecture, use HTTP protocol methods and implement a REST service using a PHP framework.


Teaching objectives
At the end of the training, the participant will be able to:
Creating classes to feed Web Services
Create various functions returning data in XML and JSON formats
Implementing a REST Web service in CRUD mode
Design web pages that use Web services
How to implement a REST service using a PHP framework

Intended audience
PHP developers, project managers.

Prerequisites
Good knowledge of PHP in a Web context (procedural and object-oriented). Basic knowledge of XML and JavaScript desirable.

Practical details
Hands-on work
Development of a CRUD web application in REST mode.

Course schedule

1
A reminder of Object-Oriented Programming

  • Class, instance, properties and methods, visibility.
  • Inheritance, interface, abstract classes.
  • Automatic methods and overload.
Hands-on work
Creation of the ADO (Abstract Data Object) class that will feed the Web Services.

2
XML, JSON, DOM, SAX and XPath

  • Well-formed XML document, basic rules.
  • Valid XML document: DTD or XSL.
  • The PHP DOM (analysis and creation).
  • XPath with PHP and validation with PHP.
  • SAX approach: XSLT transformers.
  • PHP functions for manipulating JSON format.
Hands-on work
Create a recursive DOM parsing function. Creation of an encoding/decoding function. Creation of an ADO class method, returning data in XML and JSON format.

3
REST approach

  • HTTP basics and reminders.
  • Other exchange formats: JSON, serialized PHP, MessagePack.
  • REST architecture components.
  • REST architecture design guides.
  • Logical versus physical URLs.
  • Error code definition.
  • Document a REST Web service.
  • ROA versus SOA / REST versus SOAP.
Hands-on work
Design a Web Service.

4
Implementing a REST Web service

  • Write Web Services: read, insert, update and delete data.
  • Transaction security.
  • The problem of hiding.
  • Mashup.
  • Testing a REST service: browser and testing tools.
Hands-on work
Create a Web Service in CRUD mode and secure critical operations. Configure feedback types. Creation of an RSS feed.

5
Implementing a REST Client

  • Invoke a Web Service in GET mode from PHP.
  • Use sockets and cURL to create a call context with other methods (PUT/DELETE/POST).
  • Error handling.
  • Specific features of the AJAX approach in XML and JSON mode.
  • Specific features of the AJAX approach.
  • Mashup insertion in DOM HTML mode.
Hands-on work
Implementation of a Web page consuming Web Services from several sources and presentation of aggregated results.

6
PHP frameworks

  • What is a framework?
  • Frameworks for creating REST APIs in PHP.
  • Setting up a Web Service with a framework.
Demonstration
Implementing a REST service using a framework.