Retry something until it works

0.2.0 2016-01-14 17:39 UTC

This package is not auto-updated.

Last update: 2024-11-19 05:03:28 UTC


README

Build Status Scrutinizer Code Quality Code Coverage Latest Stable Version

Retry something until it works

Installation

Install via composer

composer require spiderling-php/attempt

Usage

$attempt = new Attempt(function () {
    return ... // Try to do something
});

// Configure timeout and frequency of tries
$attempt->setTimeout(3000);
$attempt->setStep(50);

// Check how many times it will try before timing out
echo $attempt->getTries();

return $attempt->execute();

License

Copyright (c) 2015, Clippings Ltd. Developed by Ivan Kerin

Under BSD-3-Clause license, read LICENSE file.