1. Go to this page and download the library: Download japmul/retries 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/ */
japmul / retries example snippets
use Retries\Retry;
use Retries\RetryFailureException;
$procedure = function() {
// This is the function that might produce an error.
};
try {
$retry = new Retry($procedure);
$retry->setTryAmount(5); // Optional. Defaults to 3.
$retry->run();
} catch (RetryFailureException $exception) {
// All 5 times failed.
}
$retry = new Retry(function() {
// Your function.
});
$retry->setWaitTime(5);
$retry->run();
$retry = new Retry(function() {
throw new LogicException;
});
$retry->setAcceptedException(LogicException::class);
$retry->run();
use Retries\Retry;
use Retries\RetryFailureException;
$procedure = function() {
// This is the function that might produce an error.
};
try {
$retry = new Retry($procedure);
$retry->setTryAmount(5); // Optional. Defaults to 3.
$retry->run();
} catch (RetryFailureException $exception) {
$originalExceptions = $exception->getOriginalExceptions();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.