Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/igorw/retry

A tiny library for retrying failing operations.
https://github.com/igorw/retry

Last synced: about 1 month ago
JSON representation

A tiny library for retrying failing operations.

Awesome Lists containing this project

README

        

# retry

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*.

```php

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.