igorw/retry

A tiny library for retrying failing operations.

Maintainers

👁 igorw

Package info

github.com/igorw/retry

pkg:composer/igorw/retry

Statistics

Installs: 407 479

Dependents: 0

Suggesters: 0

Stars: 540

Open Issues: 5

dev-master / 1.0.x-dev 2014-09-20 11:10 UTC

Requires

  • php: >=5.4

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT c34c68c9e2a6e0f1bbab44c1dfceb73ba2a270a3

  • Igor Wiedler <igor.woop@wiedler.ch>

failure

This package is not auto-updated.

Last update: 2026-06-16 14:01:41 UTC


README

A tiny library for retrying failing operations.

Since the network is reliable, things should always work. Am I right? For those cases when they don't, there is retry.

<?
use function igorw\retry;

// retry an operation up to 5 times
$user = retry(5, function () use ($id) {
 return User::find($id);
});

// here is why you want to start using HHVM
$user = retry(5, () ==> User::find($id));

// this is probably a bad idea
$user = retry(INF, () ==> {
 throw new RuntimeException('never gonna give you up');
});
?>

I know. You're welcome.