reneiw / hiei
Http request Is Especially Import!.
1.1.0
2021-06-28 10:08 UTC
Requires
- php: ^7.4|^8.0
- ext-json: *
- campo/random-user-agent: ^1.3
- guzzlehttp/guzzle: ^7.0
This package is auto-updated.
Last update: 2025-02-28 18:41:10 UTC
README
- Http request Is Especially Import!.
Prompt
If you just need a returnable middleware.
then you can try caseyamcl/guzzle_retry_middleware.
I think you will like him.
Installing
Via Composer
$ composer require reneiw/hiei -vvv
Quickstart
use GuzzleHttp\Client; use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\HandlerStack; use Reneiw\Hiei\HieiMiddleware; use Reneiw\Hiei\HTTPService; $stack = HandlerStack::create(); $stack->push( HieiMiddleware::factory( [ //Set a maximum number of attempts per request, default 10 'max_retry_attempts' => 2, // Only retry when status is equal to these response codes, default [429, 503] 'retry_on_status' => [204, 429, 503], ] ) ); $client = new Client(['handler' => $stack]); $http = new HTTPService( $client, [ 'errorCallback' => [ function ($method, $uri, $params, GuzzleException $e) { logger()->info('123', [$method, $uri, $params, $e->getMessage()]); }, function ($method, $uri, $params, GuzzleException $e) { logger()->info('223', [$method, $uri, $params, $e->getMessage()]); }, ], ] ); return $http->request('GET', 'http://www.google.com/generate_204');
Usage
TODO
Contributing
You can contribute in one of three ways:
- File bug reports using the issue tracker.
- Answer questions or fix bugs on the issue tracker.
- Contribute new features or update the wiki.
The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.
License
The MIT License (MIT). Please see License File for more information.