2017 © Pedro Peláez
 

library conditional-retry

Conditionally retry any third party api call

image

honzamac/conditional-retry

Conditionally retry any third party api call

  • Wednesday, August 16, 2017
  • by honzamac
  • Repository
  • 1 Watchers
  • 1 Stars
  • 2,644 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 38 % Grown

The README.md

Conditional retry

Conditionally retry any third party api call., (*1)

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., (*2)

Build Status, (*3)

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., (*4)

<?php
require __DIR__ . '/vendor/autoload.php';

retryConditional(function () {
    $result = $this->sms->send('+420800100200', 'Help, I\'m drowning!');
    return $result;
}, function ($returnValue) {
    return !$returnValue;
}, 3);

Reason for retry is returned via RuntiomeException., (*5)

<?php
require __DIR__ . '/vendor/autoload.php';

retryConditional(
    function () { 
        // do stuff
        throw new \RuntimeException();
    },
    function ($value, $exception) { return $exception instanceof \RuntimeException;},
    3
);

When all retries failed, last return value/exception is returned / re-throwed. For more information take a look on tests., (*6)

Requirements

  • PHP 7.0 is required but using the latest version of PHP is highly recommended

Installation

You can add this library as a local, per-project dependency to your project using Composer:, (*7)

composer require honzamac/conditional-retry

Contributing

Any contributions are welcome., (*8)

The Versions

16/08 2017

dev-master

9999999-dev

Conditionally retry any third party api call

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Jan Machala

retry failure conditionally retry

16/08 2017

v0.1

0.1.0.0

Conditionally retry any third party api call

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Jan Machala

retry failure conditionally retry

01/08 2017

v0.1-RC

0.1.0.0-RC

Conditionally retry any third party api call

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Jan Machala

retry failure conditionally retry

20/06 2017

v0.1-beta

0.1.0.0-beta

Conditionally retry any third party api call

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Jan Machala

retry failure conditionally retry