1. Go to this page and download the library: Download vincenzoraco/again 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/ */
vincenzoraco / again example snippets
while (!$this->isSent()) {
$this->sendEmail();
}
Again::perform(fn(int $i) => $this->sendEmail())
->limitTo(3) // Stop after 3 attempts
->until(fn(int $i) => !$this->isSent()) // Stop if email is sent
->execute();
$action = Again::perform($actionLogic)
->limitTo($limit) // Limit the number of iterations
->until($until) // Define the condition to stop
->execute();
$stopReason = Again::perform($actionLogic)
->limitTo($limit)
->until($until)
->execute(); // Execute and get the stop reason
// Check the reason for stopping
if ($stopReason === AgainStopReason::MAX_ITERATIONS_REACHED) {
$this->notifyToSlack('Maximum retries reached.');
// Handle the case when max iterations are reached
}
if ($stopReason === AgainStopReason::CONDITION_MET) {
// Handle the case when the condition was met and the loop stopped
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.