Guzzle-powered HTTP client driver--makes real HTTP requests using the battle-tested Guzzle library.
composer require marko/http-guzzleuse Marko\Http\Contracts\HttpClientInterface;
class ApiClient
{
public function __construct(
private HttpClientInterface $httpClient,
) {}
public function fetchData(): array
{
$response = $this->httpClient->get('https://api.example.com/data', [
'headers' => ['Accept' => 'application/json'],
]);
return $response->json();
}
}Full usage, API reference, and examples: marko/http-guzzle