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 ...
Newsletter

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

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners