PHPackages                             sparkcentral/backoff - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. sparkcentral/backoff

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sparkcentral/backoff
====================

Utility trait with retry (back off) functionality

v1.1.0(9y ago)050.7k↑56.4%1MITPHPPHP &gt;=5.6

Since Jul 26Pushed 9y ago4 watchersCompare

[ Source](https://github.com/sparkcentral/backoff)[ Packagist](https://packagist.org/packages/sparkcentral/backoff)[ RSS](/packages/sparkcentral-backoff/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (3)Used By (0)

Backoff
=======

[](#backoff)

Simple utility trait which provides backoff / retry functionality.

[![Build Status](https://camo.githubusercontent.com/081328760bf0fb23c6490c583459141f689a9d5f42598e420b27343531c5fb4f/68747470733a2f2f7472617669732d63692e6f72672f737061726b63656e7472616c2f6261636b6f66662e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/sparkcentral/backoff)

Features
--------

[](#features)

- Two different strategies: `backoffOnException`, `backoffOnCondition`
- You can provide list of exception classes so that retry will happen only when one of those from the list is thrown.
- You can pass custom function to backoffOnCondition which defines whether to retry operation or not.
- Retries happen with delays which grow linearly (y=x\*2), you can pass custom starting delay as well.

For details please refer to documentation for `backoffOnException()`, `backoffOnCondition()` methods.

Dependencies
------------

[](#dependencies)

- PHP &gt;= 5.6 (variadics)

Basic example
-------------

[](#basic-example)

```
