Retry something until it works

Installs: 79

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/spiderling-php/attempt

0.2.0 2016-01-14 17:39 UTC

This package is not auto-updated.

Last update: 2025-10-07 09:37:37 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.