Consuming a REST API with Guzzle and PHP

Guzzle is an HTTP client that provides methods which make sending HTTP requests, processing the response, and interacting with web services easy. It provides a very clean API, uses PSR-7 interfaces, and has built-in unit testing support.
Course info
Level
Intermediate
Updated
Aug 29, 2019
Duration
1h 27m
Table of contents
Description
Course info
Level
Intermediate
Updated
Aug 29, 2019
Duration
1h 27m
Description

Guzzle is an HTTP client that makes the interaction with the web services easy. It provides methods which make sending HTTP requests and processing the responses easy, and it can be used instead of cURL. While cURL is one of the most adapted tools for the interaction with APIs, there are benefits of using Guzzle over cURL. For example, Guzzle provides a very clean API to work with, is very well documented, and has built-in unit testing support - which cURL doesn't have. All in all, guzzle provides a comparatively cleaner and easier way to mock the HTTP layer. Besides all this, guzzle uses the PSR-7 interface, so you can use any library that implements the PSR-7 standards with Guzzle. This course, Consuming a REST API with Guzzle and PHP, will teach you how to use Guzzle to consume REST APIs, including how you can use Guzzle to create synchronous and asynchronous requests, how to deal with exceptions, and how to process the response and headers. It will also give an insight into using the PSR-7 standard with Guzzle. By the time you're finished with this course, you'll feel confident using Guzzle in your applications.

About the author
About the author

Annapurna is a full stack developer and has experience in Android App and web development. She likes sharing knowledge so that the developers around get boost for their passion.

More from the author
Working with Date and Time in PHP
Beginner
2h 16m
Jun 27, 2019
Android: Room Fundamentals
Beginner
2h 27m
Dec 7, 2018
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hi everyone, my name is Annapurna Agrawal, and welcome to my course on Consuming a REST API with Guzzle and PHP. I'm a full stack developer, and I like teaching and sharing knowledge and aim to make your day-to-day development task easy. Guzzle is an HTTP client that makes the interaction with the web services easy. In this course, we are going to learn how to use Guzzle while extracting and consuming the resources in the web, or processing the responses that we receive from the APIs. Some of the major topics that we will cover include why should you choose Guzzle while there is cURL. Next we will see how to create advanced requests and work with responses in Guzzle. We will see how to deal with the client-side, as well as the server-side exceptions in HTTP, and we will also cover what is PSR-7 and how Guzzle utilizes it. By the end of this course, you will know how to use Guzzle to implement it in your project for the API interactions in your own application. You will also master handling each part of your API requests and responses while using Guzzle. Before beginning the course, you should be familiar with what is HTTP and how HTTP works, you should have an idea of what REST is, and since you're going to use PHP, you should be able to write and understand the code in PHP. I hope you'll join me on this journey to learn using Guzzle to consume REST API in PHP course, only at Pluralsight.