Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/honzamac/conditional-retry

Retry any third party api call based on you custom conditions
https://github.com/honzamac/conditional-retry

failover php7 retrying

Last synced: 2 months ago
JSON representation

Retry any third party api call based on you custom conditions

Awesome Lists containing this project

README

        

# Conditional retry

Conditionally retry any third party api call.

Sometimes network connection is not working properly and we would like to retry api call. Using this tiny library you can easily retry any action based on specific error condition throwed by exception or returned value.

[![Build Status](https://travis-ci.org/HonzaMac/conditional-retry.svg?branch=master)](https://travis-ci.org/HonzaMac/conditional-retry)

## Usage

Reason for retry is returned via `return $result`. First argument is required api call, second argument is conditional callback, third argument defines how many total runs will api call do.
```php
sms->send('+420800100200', 'Help, I\'m drowning!');
return $result;
}, function ($returnValue) {
return !$returnValue;
}, 3);
```

Reason for retry is returned via `RuntiomeException`.
```php