PHP Classes

PHP Retry Library: Keep calling a function until it meets a condition

Recommend this page to a friend!
  Info   View files Example   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 271 This week: 1All time: 7,707 This week: 560Up
Version License PHP version Categories
retryclass 1.0.0MIT/X Consortium ...5PHP 5, Time and Date, Language
Description 

Author

This simple class can keep calling a function until it meets a condition.

It takes a given callback function and calls it to check if it returns a value that states that a certain condition is meet.

Until the condition state is reached, the class keeps calling the function after a given period of time, which by default is one minute.

Innovation Award
PHP Programming Innovation award nominee
March 2018
Number 3


Prize: One downloadable copy of Komodo IDE
Sometimes applications need to wait for conditions that may take some time to happen, like for instance waiting for a given period to pass until you execute a periodic task.

This package can help implementing these tasks that need to be repeated after a given time interval until a certain condition is met.

Manuel Lemos
Picture of Arnel Labarda
  Performance   Level  
Name: Arnel Labarda <contact>
Classes: 6 packages by
Country: Philippines Philippines
Age: 37
All time rank: 248322 in Philippines Philippines
Week rank: 416 Up5 in Philippines Philippines Up
Innovation award
Innovation award
Nominee: 4x

Winner: 1x

Example

<?php

// will retry 5 times by default at 1 minute interval
$retry_command = new RetryCall;

$retry_command->retry(function() {
   
$elephant = 1;
   
$ant = 0;

    return
$ant >= $elephant;
});


  Files folder image Files  
File Role Description
Accessible without login Plain text file example.php Example example usage
Plain text file retry-class.php Class retry class

 Version Control Unique User Downloads Download Rankings  
 0%
Total:271
This week:1
All time:7,707
This week:560Up