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

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

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)
```