Laravel now provides an expressive, minimal API around the Guzzle HTTP client, allowing you to quickly make outgoing HTTP requests to communicate with other web applications & web services.
Laravel’s wrapper around Guzzle is focused on its most common use cases and a wonderful developer experience. For example, the client makes it a breeze to POST and interface with JSON data:
use Illuminate\Support\Facades\Http; $response = Http::withHeaders([ 'Authentication' => 'Bearer $token' ])->post('http://test.com/users', [ 'name' => 'janedoe', ]); return $response['id'];
$response = Http::get($url); $response = Http::get($url,['name'=>'janedoe']);
Now with new HTTP Client, its even easier in getting responses instead of
json_decode and then retrieving the body as we used to in
$response['name'] $response->body() $response->json() $response->status() $response->ok()