Download the PHP package four-bytes/four-http-client without Composer
On this page you can find all versions of the php package four-bytes/four-http-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download four-bytes/four-http-client
More information about four-bytes/four-http-client
Files in four-bytes/four-http-client
Package four-http-client
Short Description Modern PHP 8.4+ HTTP client factory and middleware library for API integrations
License MIT
Informations about the package four-http-client
Four HTTP Client
A modern PSR-18 HTTP client library for PHP 8.4+ with middleware support. Built for API integrations with generic transport and authentication layers.
Features
- PSR-18 Compliant — Works with any PSR-18 compatible client
- Middleware Stack — Logging, rate limiting, retry, authentication
- Authentication — Bearer tokens, API keys, OAuth 2.0, OAuth 1.0a
- Retry Logic — Exponential backoff with configurable policies
- Error Mapping — 401 → AuthenticationException, 404 → NotFoundException, 429 → RateLimitException
Installation
Requires PHP 8.4+ and PSR packages:
psr/http-client: ^1.0psr/http-factory: ^1.0psr/http-message: ^2.0psr/log: ^3.0
Recommended: php-http/discovery for automatic transport discovery.
Quick Start
Option 1: PSR-18 Client with HttpClientFactory
Build a PSR-18 compliant client and use it directly with PSR-17 request factories:
Option 2: Extend ApiClient for Custom API Clients
Create a typed client for your specific API:
Configuration
ClientConfigBuilder
Fluent builder for client configuration:
Retry Configuration
Middleware
Logging
Rate Limiting
Requires four-bytes/four-rate-limiting:
Retry
Custom Middleware
Implement Four\Http\Middleware\MiddlewareInterface:
Authentication
TokenProvider
Simple bearer/API tokens:
OAuthProvider
OAuth 2.0 with automatic token refresh:
OAuth1aProvider
OAuth 1.0a signature-based authentication:
Custom Transport
Implement Four\Http\Transport\HttpTransportInterface for custom HTTP backends:
Error Handling
The library maps HTTP status codes to specific exceptions:
Requirements
- PHP 8.4+
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
- psr/http-message: ^2.0
- psr/log: ^3.0
- php-http/discovery: ^1.19
Optional:
- symfony/http-client — Alternative transport
- guzzlehttp/guzzle — Alternative transport
License
MIT License - see LICENSE file.
All versions of four-http-client with dependencies
psr/log Version ^3.0
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^2.0
php-http/discovery Version ^1.19
four-bytes/four-rate-limiting Version ^1.3