PHP code example of webclient / ext-retry

1. Go to this page and download the library: Download webclient/ext-retry library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

webclient / ext-retry example snippets




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);