Web Development


Use Laravel to Consume APIs and Services Over HTTP

Create an HTTP client with Laravel and Guzzle HTTP to consume any API and online service over HTTP requests from Laravel

4.55 (64 reviews)



5.5 hours


Jun 2020

Last Update
Regular Price

What you will learn

Consume any HTTP service (yours or from a third party)

Re-utilize the components created during the course to consume any HTTP service you want

Authenticate users in your HTTP Client using information obtained from external HTTP services

Build and HTTP Client with Laravel, completely modular and maintainable

Domain the usage of access tokens and OAuth2 when sending requests and authorizing the requests of your HTTP Client


Do you need to consume an HTTP Service or API and it overwhelms you to think about HTTP methods, requests, OAuth2, access tokens, credentials, grant types, user sessions and so on?

I cover you! In this course, I show you that everything is about using the correct values ​​and tools to make everything much simpler.

Create your HTTP client with Laravel: Build and design a web project with Laravel, to consume online services and APIs.

Obtain data from HTTP services or APIs (yours or from third parties) and show it in a friendly and correct way to your users.

Learn step-by-step, everything you need to consume any web service or API online, with PHP from a Laravel project and using Guzzle.

At the end of the course, you will have multiple components that you can re-utilize in your projects to consume any HTTP service or API.

Do not wait any longer and sign up :)

Why should you choose this course?

  • Because it gives you a detailed view, as in no other course, of how to consume an HTTP service or API using Laravel and PHP.

  • Because it gives you the essential components that you can re-utilize in your other projects when consuming any HTTP service or API

  • Because you will be able and confident enough to use any service or API protected by OAuth2 and access tokens.

  • Because I not only show you how to create your HTTP Client with Laravel, but I also help you identify the different challenges of an HTTP Client and how to solve them properly.

  • Because simply, there is no other course that covers all these topics.

What will you be able to do at the end of the course?
In general, you will be able to implement an HTTP client that allows you to consume any HTTP service or API, either your own or from third parties, using PHP and Laravel. In addition, you will have a clear idea of ​​how to proceed when facing new projects and services to be consumed, reusing as much as possible the components created and learned during this course.

You will know how to use a high-level library such as Guzzle, to send HTTP requests from PHP with Laravel. Implementing generic components that allow sending requests of any kind to any HTTP service with Guzzle.

In the end, you will have gained complete confidence in sending secure and correctly authorized requests to different HTTP services, either using simple access tokens or even using an entire security mechanism such as OAuth2. Everything, using PHP and Laravel.

During the course, you will learn this...

For the HTTP Client:

  • How to consume a service or API through HTTP requests from Laravel

  • How to authenticate and create user sessions in your HTTP Client with information from other services

  • How to automate the process of obtaining an access token to authorize the requests of your HTTP Client

  • The different ways to obtain an access token from a service that uses OAuth2 and its differences (grant types)

  • How to handle the expiration times of a token and avoid losing access to information

  • How to handle access errors to the consumed HTTP service or API and how to proceed

  • How to handle and authenticate protected requests associated with a user's information from the HTTP Client

  • Use of Guzzle from Laravel, to send HTTP requests to whatever HTTP service or API

  • How to configure and prepare Laravel to make requests to any HTTP service or API

  • Use of Bootstrap 4 to show the information obtained from the consumed services

  • Handling and preparing to resolve exceptions and errors when consuming external services with Laravel

For any Laravel project:

  • How to install Laravel in your development environment for professional projects

  • Configure Laravel, in your environment for an agile and simple development

  • Build of a professional, modular and, a scalable project with Laravel

  • Creation of routes, views, templates, controllers and more with Laravel

  • Handling errors and internal exceptions of the Laravel project

  • Installation of dependencies to a Laravel project (Guzzle case)

Of course, that's not all. Take a look at the full description of sections and classes for more details.

It does not end there! You will have lifetime access to current classes and those I can add later to the course.

Subscribe now and do not wait any longer to consume those services that you need and obtain the information that your users require.

Still having doubts?

Do not worry, here I share some more information about HTTP Client with Laravel.

Why an HTTP Client with Laravel?

About HTTP:

HTTP (HyperText Transfer Protocol) is a widely used protocol on the Internet and any current language has a mechanism to make requests on HTTP in a simple way which, of course, includes PHP and Laravel (a framework for PHP).

Since HTTP is a protocol that is currently widely used, any current system or language will be able to communicate correctly with other systems that use this protocol (regardless of the programming language), allowing the use of data and information from whatever system online. Such information, obtained from any HTTP service, can be used in your projects to offer any type of information and service to the users of your systems. This makes you an HTTP client since you will be consuming any HTTP service or API from your own project.

About Laravel:

Laravel is the most popular framework for PHP, even one of the most popular in the world. With Laravel, you will be able to develop very complex PHP applications in a very short time, which includes an HTTP Client. During the course, you will see the enormous facilities that Laravel provides when obtaining and using the information of importance for your users, as well as facilitating the process of integrating external systems easily.

Laravel has innumerable characteristics that differentiate it from multiple frameworks for PHP and other languages, which allow implementing very complex tasks in a simple way and in a short time.

Of course, if you need more information, just get in touch :)

Subscribe now. See you in classes


Use Laravel to Consume APIs and Services Over HTTP
Use Laravel to Consume APIs and Services Over HTTP
Use Laravel to Consume APIs and Services Over HTTP
Use Laravel to Consume APIs and Services Over HTTP


Meet the course, the instructor and the service to consume

What you will see, learn and obtain from this course

About the instructor of the course

About the development environment to use in the course

The source code of the HTTP Client with Laravel

Details about the API or HTTP Service to be consumed from the HTTP Client

About the API to consume

Creating a client and users for the API to consume

The different ways to authenticate requests to the API (OAuth2)

How to refresh tokens and handle the scope of the token

The responses, actions, and restrictions of the API to consume

Creating and preparing a Laravel project for the HTTP Client

Obtaining the Laravel structure for the HTTP Client

Adding Guzzle to make HTTP requests from Laravel

Laravel 6 additional step

Preparing the environment with a simple configuration

Preparing the HTTP client to store and authenticate users

Building the initial graphical interface of the HTTP client

Laravel 6: Before starting this section

Generating the initial components of the HTTP client interface

Generalizing the welcome view of the HTTP Client

Allowing to display the HTTP Client messages in any location

Adding the possibility to login directly with the API

Preparing the Laravel project to consume the target service

Creating a generic component to consume HTTP services from Laravel

Creating the component that will know how to consume the target service

Preparing the configuration of the service to consume

Implementing the necessary methods to consume the HTTP Service

Implementing the method to authorize requests

Implementing the method to decode the HTTP API responses

Implementing the method to detect error responses

Facilitating and generalizing the use of the Service created in the Client

Making the first requests to the HTTP service and showing the results

Getting the list of products from the API

Showing the list of products on the main page of the HTTP Client

Obtaining the list of categories from the HTTP service

Adding the list of categories to the main page of the HTTP Client

Obtaining the details of a specific product from the API

Showing the details of a specific product

Obtaining the products of a category of the HTTP service

Showing the products of a category in the HTTP Client

Automating the obtaining of access tokens associated with the HTTP Client

Adding a new service to obtain access tokens from the HTTP Client

Automatically obtaining a token associated with the HTTP Client

Using tokens obtained automatically when consuming the API

Avoiding getting a token for every request to the HTTP Service

Authenticating users directly from the API

Generating the URL to enable the login button with the API

Preparing the button to obtain the authorization of the users

Obtaining a valid token from the authorization code

Obtaining the users information from the HTTP service

Registering or updating users with information from the API

Creating sessions for users validated by the HTTP service

Authenticating users directly with email and password

Obtaining a valid token from the user credentials

Authenticating a user in the HTTP Client through their credentials

Properly handling attempts with invalid credentials

Improving the experience of users authenticated in the HTTP client

Adding possible actions for authenticated users

Adding links to protected actions for authenticated users

Determining when to use a user token or a client token

Refreshing expired user tokens

Implementing protected actions for HTTP client users

Showing the name of a user, obtained directly from the API

Allowing products to be published by an authenticated user

Preparing the client to send files on requests

Publishing products with the information given to the HTTP client

Associating a product to the indicated category

Making a published product available

Allowing to purchase products from an authenticated user

Showing the purchases list to a user authenticated in the HTTP client

Showing the list of publications of an authenticated user

Handling errors and exceptions in the HTTP Client

Preparing the HTTP client to handle failures in requests

Handling authentication errors when consuming the API

Handling the remaining errors when consuming the HTTP Service

Handling internal exceptions of the HTTP Client


How to use and apply what you have learned in your own HTTP clients

Bonus Lecture


Fernando23 December 2020

Respecto de los subtítulos. Si los traduzco con Google, no es muy entendible. Se utilizan palabras que no tienen relación con el contexto. Sería provechoso, que además hubiera subtítulos en español.

Matthew4 September 2020

Highly recommended course for anyone looking to implement an http client to consume an API. The project is very practical and useful allowing requests for products, categories, users & purchases. It covers all crud methods. The instructor is very enthusiastic and quick to respond to questions . I was hesitant before taking the course as I was not 100% sure it was what I needed ... but this course does exactly what it says it does - creates a http client that can consume any API. Thanks Juan - great job!

Bernard3 June 2020

The label for this class is send requests to ANY http service and api, but the class does not follow through. The example is for a custom API setup by the instructor. It is mildly helpful, but may lead you down a rabbit hole.

Filipe16 April 2020

My only negative point is the section II of this course. I hope when i finish the all course, my opinion change.

John20 January 2020

Terrific course! Juan was a great instructor, and I will be able to directly apply what I learned to an app I'm building. Highly recommended!

Ghazi11 July 2019

Yes yes yes. straight to the point. I would suggest you adjust each lesson's bugs by recording again and give more example like another api in order to see how this project can fit in other services but it is already excellent. Thank you Juan

Egam3 June 2019

A very good course that covers a lot of things other tutorials on youtube skips. I.e. many other tutorials will just consume an API via the controller, while here it's set up properly via traits and services, making it more robust. The only drawback is that I'd love to see a tutorial for how to pull API data this way into a database via eloquent models.

Ronald27 May 2019

Instructor is obviously very knowledgeable, but the extremely thick accent with poor pronunciation of common words will make it hard for me to make it through this course. Update: somehow I made it halfway through.

Himanshu25 May 2019

Good Course. Just need little improvement with some code. I think, you can improve a little better on it, thats why i am giving u 1/2 less star.


Udemy ID


Course created date


Course Indexed date
Course Submitted by

Android PlayStore
Apple Appstore