Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/igorw/retry
- Owner: igorw
- License: mit
- Created: 2014-09-19T21:48:06.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2020-01-31T21:05:42.000Z (almost 5 years ago)
- Last Synced: 2024-10-01T11:09:36.879Z (about 1 month ago)
- Language: PHP
- Size: 674 KB
- Stars: 542
- Watchers: 19
- Forks: 29
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
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.