Zttp is coming to Laravel 7

Zttp is coming to Laravel 7

The Zttp Guzzle wrapper package by Adam Wathan will be coming to Laravel 7 as a new Http package. According to the pull request to add this feature, it provides a much nicer syntax for the 90% use case of Guzzle where you just need to POST some JSON to an endpoint.

Here is some of the basic usage of the new Http package:

use Illuminate\Support\Facades\Http;

$response = Http::post('url', [
    'name' => 'Taylor',
]);

echo $response['foo'];

$response->body()
$response->json()
$response->status()
$response->ok()
$response->successful() (>= 200 && < 300)
$response->serverError()
$response->clientError()

It’s also worth noting that in the PR Taylor says, this is not an entirely new client – it is only a UX / DX convenience layer on top of Guzzle. They will not be adding a lot of complicated features, and if you need something more, just use Guzzle directly.

For more details on this new HTTP package check out the pull request, and I’m certain Taylor will give more information on it during his Laravel 7 talk at Laracon Online.

Filed in: News
Laravel News Partners

Laravel Jobs

Backend Software Engineer (PHP Developer)
Austin TX, Bonita Springs FL
Certified eSupport Corp
Laravel Developer
Glendale, CA (COVID Remote)
Jogg, Inc
Senior PHP Engineer
Remote, USA Only
Kittyhawk
Full Stack Engineer
Remote
Shelterluv
Kickass LaraDev!
Remote
Megaverse

Newsletter

Join 31,000+ others and never miss out on new tips, tutorials, and more.