https://github.com/icanhazstring/retry
Small dependency-less library to retry failing operations
https://github.com/icanhazstring/retry
Last synced: about 1 year ago
JSON representation
Small dependency-less library to retry failing operations
- Host: GitHub
- URL: https://github.com/icanhazstring/retry
- Owner: icanhazstring
- License: mit
- Created: 2021-06-25T11:33:11.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-06-25T13:13:19.000Z (about 5 years ago)
- Last Synced: 2025-03-08T10:05:37.606Z (over 1 year ago)
- Language: PHP
- Size: 8.79 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# icanhazstring/retry
Small dependency-less library to retry failing operations
## Installation
```bash
$ composer require icanhazstring/retry
```
## Usage
```php
// retry(callable, retries = 1, sleep = 10);
// call failingMethod, maximum 3 retries, wait 100ms between retires
retry(fn() => failingMethod(), 3, 100);
retry(function() use ($dependency) {
failingMethod();
}, 3, 100)
```