When I work with APIs, I usually create a single PHP class which is responsible for sending the Guzzle HTTP request. It usually looks like this: <?php namespace App\Services\IMDB; use GuzzleHttp\Client; use GuzzleHttp\Psr7\Response; class HttpClient { public function send(array $payload) : Response { return app(Client::class) ->request('POST', 'https://api.example.com/movies', $payload); } } I don't write Unit Tests for such a simple class, but I will write Integration Tests to cover the feature, which will trigger the class in some way or another. When I want to test how my app reacts ...

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Community Partners