Laravel 8.x Http Client Request Example

In this Laravel 8 guzzle http clinet request example tutorial, i will discuss how we can use laravel 8 http client request. In this example tutorial you will learn laravel 8 http client request. 

Laravel provides an expressive, minimal API around the Guzzle HTTP client, allowing you to quickly make outgoing HTTP requests to communicate with other web applications. This is going to be a simple example of laravel 7 HTTP Client post. 

To make requests, you may use the getpostputpatch, and delete methods. First, let's examine how to make a basic GET request: Laravel 8 provide built in HTTP Client request using guzzlehttp/guzzle package. You can easily run http client request using Http facade from the version of Laravel 8. 

Here, i will give you a simple demo exmaple. So that you can learn how to use HTTP facades in client request. Let's see the example of Laravel 8 http client rrquest.


Install guzzlehttp/guzzle

Before using http client we need to install Guzzle package as a dependency of your application. So install it by the below command.

composer require guzzlehttp/guzzle



use Illuminate\Support\Facades\Http;

$response = Http::get('');


GET Request Query Parameters

$response = Http::get('', [
    'name' => 'Taylor',
    'page' => 1,



$response = Http::post('', [
    'name' => 'Steve',
    'role' => 'Network Administrator',


Multi-Part Requests

If you would like to send files as multi-part requests, you should call the attach method before making your request. 

$response = Http::attach(
    'attachment', file_get_contents('photo.jpg'), 'photo.jpg'


Instead of passing the raw contents of a file, you may also pass a stream resource:

$photo = fopen('photo.jpg', 'r');

$response = Http::attach(
    'attachment', $photo, 'photo.jpg'


Read also : Laravel 7.x Guzzle Http Client Request Example


Hope it can help you.


#guzzle-http-client #guzzlehttp #client-request #guzzle #laravel #laravel-7