PHP code example of icecave / interlude

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

    

icecave / interlude example snippets


use Icecave\Interlude\Exception\AttemptsExhaustedException;
use Icecave\Interlude\Exception\TimeoutException;
use Icecave\Interlude\Invoker;

$invoker = new Invoker;

$operation = function ($remainingTimeout, $remainingAttempts) {
    // do work ...
};

try {
    $invoker->invoke(
        $operation,
        10, // ten second timeout
        3   // maximum of three attempts
    );
} catch (TimeoutException $e) {
    echo 'The operation timed out!' . PHP_EOL;
} catch (AttemptsExhaustedException $e) {
    echo 'The operation was attempted the maximum number of times!' . PHP_EOL;
}