Skip to content

Solo HTTP ClientFluent requests. Safe defaults.

An immutable PSR-18 client on Guzzle. Configure it once and share it; tokens stay with their origin, retries never repeat a payment, and logs never show a secret.

Solo HTTP Client

Configure and send ​

php
use Solo\HttpClient\HttpClient;

$api = HttpClient::create('https://api.example.com/v1/')
    ->timeout(10)
    ->withToken($token)
    ->retry(3, 500);

$response = $api->get('users', ['query' => ['page' => 2]]);

if ($response->successful()) {
    $users = $response->json('data'); // null when the body is not valid JSON
}

$api->post('users', ['json' => ['name' => 'Ada', 'email' => 'ada@example.com']]);

The token goes only to https://api.example.com. A 404 or a 503 comes back as a response; only a failed transfer throws. Read the getting-started guide and the API reference for credentials, retries, uploads, logging and errors.

Installation ​

PHP 8.1+ is required, with Guzzle 7.15.2 or later.

sh
composer require solophp/http-client

Continue with the getting-started guide.

MIT licensed.