ariyx / http-client
A small PSR-18 HTTP client backed by cURL.
v3.0.0
2026-08-16 08:54 UTC
Requires
- php: ^8.3
- ext-curl: *
- nyholm/psr7: ^1.8.2
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
- psr/http-message: ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpstan/phpstan: ^2.2
- phpunit/phpunit: ^12.5
Provides
README
A small, standards-based PSR-18 HTTP client for PHP, backed by cURL.
Requirements
PHP 8.3+ and ext-curl.
Installation
composer require ariyx/http-client
Usage
use Ariyx\HttpClient\Client; use Nyholm\Psr7\Request; $client = Client::create(); $request = new Request('GET', 'https://example.com'); $response = $client->sendRequest($request); echo $response->getStatusCode(); echo $response->getBody();
Retry transient failures with the included client middleware:
use Ariyx\HttpClient\Middleware\RetryMiddleware; $client = Client::create(middleware: [new RetryMiddleware()]);
Error handling
HTTP 4xx and 5xx responses are returned normally. Network and invalid-request failures throw PSR-18 compatible exceptions.
Development
composer check
License
MIT