Skip to content

Latest commit

 

History

History
35 lines (25 loc) · 737 Bytes

File metadata and controls

35 lines (25 loc) · 737 Bytes

marko/http-guzzle

Guzzle-powered HTTP client driver--makes real HTTP requests using the battle-tested Guzzle library.

Installation

composer require marko/http-guzzle

Quick Example

use 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();
    }
}

Documentation

Full usage, API reference, and examples: marko/http-guzzle