PHP code example of nsleta / exponential_backoff

1. Go to this page and download the library: Download nsleta/exponential_backoff 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/ */

    

nsleta / exponential_backoff example snippets


    $retry = new ExponentialBackoff\Retry();
    $retry->setInterval(3000); // optional, default interval is 2000
    $retry->setMaxAttempts(2); // optional, default max attempts is 3
    $result = $retry->call(function() { return 'done'; }, [RuntimeException::class]);