PHP code example of divineomega / attempt
1. Go to this page and download the library: Download divineomega/attempt 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/ */
divineomega / attempt example snippets
// Attempts to run the function immediately. If an exception occurs, retry forever.
attempt(function() {
// ...
})->now();
// Attempts to run the function immediately. If an exception occurs, retry up to 5 times.
attempt(function() {
// ...
})->maxAttempts(5)
->now();
// Attempts to run the function immediately. If an exception occurs, retry until the specified date time.
attempt(function() {
// ...
})->until($datetime)
->now();
// Attempts to run the function immediately. If an exception occurs, retry forever, with a 20 second gap between attempts.
attempt(function() {
// ...
})->withGap(20)
->now();
// Attempts to run the function at a specified date time. If an exception occurs, retry forever. The thread will block until the specified date time is reached.
attempt(function() {
// ...
})->at($datetime);