webclient / ext-retry
PSR-18 HTTP 客户端的重试扩展
v1.0.1
2022-07-22 14:50 UTC
Requires
- php: ^7.0 || ^8.0
- psr/http-client: ^1.0
Requires (Dev)
- ext-json: *
- nyholm/psr7: ^1.3
- phpunit/phpunit: ^6.5 || ^7.5 || ^8.5 || ^9.5
- squizlabs/php_codesniffer: ^3.5
- webclient/fake-http-client: ^2.0
Suggests
- psr/http-client-implementation: Choice your favorite psr-18 implementation
Provides
This package is not auto-updated.
Last update: 2024-09-14 00:42:19 UTC
README
webclient/ext-retry
PSR-18 HTTP 客户端的重试扩展。
安装
安装此包以及您喜欢的 psr-18 实现。
composer require webclient/ext-retry:^1.0
使用
<?php use Webclient\Extension\Retry\RetryClientDecorator; use \Webclient\Extension\Retry\Timer\Timer; use Psr\Http\Client\ClientInterface; use Psr\Http\Message\RequestInterface; /** * @var ClientInterface $client Your PSR-18 HTTP Client * @var Timer $timer Timer implements * @var int $maxAttempts Max attempts */ $http = new RetryClientDecorator($client, $timer, $maxAttempts); /** @var RequestInterface $request */ $response = $http->sendRequest($request);