Download the PHP package deeep/service-client-bundle without Composer
On this page you can find all versions of the php package deeep/service-client-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download deeep/service-client-bundle
More information about deeep/service-client-bundle
Files in deeep/service-client-bundle
Package service-client-bundle
Short Description Symfony bundle: HTTP client with retry, multi-host, circuit breaker, and async support via Fibers
License BSD-3-Clause
Informations about the package service-client-bundle
Service Client Bundle
π Language: Π ΡΡΡΠΊΠΈΠΉ
Symfony bundle: HTTP client with retry, multi-host failover, circuit breaker, and async support via PHP Fibers.
Features
- Retry with exponential backoff β configurable delay, jitter, and status codes
- Multi-host strategies β failover, round-robin, parallel
- Circuit breaker β automatic failure detection and recovery
- Async via Fibers β non-blocking requests with Revolt event loop
- Middleware pipeline β extensible request/response processing
- Multiple auth methods β Bearer, API Key, Basic
- Typed requests β ISP-based interfaces with response mapping
Requirements
- PHP 8.4+
- Symfony 7.4+ | 8.0+
- Guzzle 7.9+
Installation
Register the bundle in config/bundles.php:
Configuration
Usage
Typed Request (Recommended)
POST Request with Body
Request Builder (Quick Requests)
The builder is immutable β each method returns a new instance:
Async Requests
Callbacks
Error Response Callbacks
Use onErrorResponse() for handling 4xx/5xx responses separately from network errors:
then($onSuccess)β called for 2xx responsesonErrorResponse($callback)β called for 4xx/5xx responses with bodythen(null, $onError)β called for network errors (timeout, connection failed)
Request Interfaces (ISP)
| Interface | Purpose |
|---|---|
RequestInterface |
Base request (service, method, uri, headers, query, body) |
AuthRequiredInterface |
Marker: request requires authentication |
ConfigurableRequestInterface |
Override timeout/retry for specific request |
MappableRequestInterface<T> |
Custom response mapping to type T |
ErrorMappableRequestInterface<E> |
Custom error response (4xx/5xx) mapping to type E |
Also available: BaseRequest β base class with default implementations for getHeaders(), getQuery(), getBody().
Handling Error Responses
Implement ErrorMappableRequestInterface for custom mapping of error responses (4xx/5xx):
Multi-Host Strategies
Failover
Tries hosts in order, switches on 5xx or network error:
Round-Robin
Distributes load across hosts:
Parallel
Sends to all hosts, returns first successful response:
Retry Configuration
Authentication Types
Bearer Token
API Key
Basic Auth
Middleware Pipeline
Requests pass through middleware chain in priority order:
| Priority | Middleware | Purpose |
|---|---|---|
| 100 | AuthMiddleware | Adds Authorization header |
| 90 | RetryMiddleware | Retries with exponential backoff |
| 80 | LoggingMiddleware | Logs requests/responses |
| 60 | CircuitBreakerMiddleware | Cascade failure protection |
| 10 | MultiHostMiddleware | Failover/round-robin/parallel |
More details: docs/en/middleware.md
Documentation
- Configuration
- Middleware
- Multi-Host
License
BSD-3-Clause
All versions of service-client-bundle with dependencies
guzzlehttp/guzzle Version ^7.9
guzzlehttp/promises Version ^2.0
psr/log Version ^3.0
revolt/event-loop Version ^1.0
symfony/config Version ^7.4|^8.0
symfony/dependency-injection Version ^7.4|^8.0
symfony/http-kernel Version ^7.4|^8.0