PHPackages                             borisguery/transient-error-handling - 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. borisguery/transient-error-handling

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

borisguery/transient-error-handling
===================================

Transient Error Handling

0.5(3y ago)5102.2k↓31.3%1[1 PRs](https://github.com/borisguery/PHPTransientFaultHandling/pulls)2MITPHPPHP ^7.3||^8.0CI passing

Since Jan 13Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/borisguery/PHPTransientFaultHandling)[ Packagist](https://packagist.org/packages/borisguery/transient-error-handling)[ RSS](/packages/borisguery-transient-error-handling/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (8)Used By (2)

transient-error-handling
========================

[](#transient-error-handling)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b7b87c993de0d75ed654b28d57b4ed6486f622350cabd73d5163131c41b29d42/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626f72697367756572792f7472616e7369656e742d6572726f722d68616e646c696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/borisguery/transient-error-handling)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/4906c042036999a58bc7f7169f7909868c3f4c6dbee0d348fd2cf9fdf22b69c6/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f626f72697367756572792f5048505472616e7369656e744661756c7448616e646c696e672f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/borisguery/PHPTransientFaultHandling)[![Coverage Status](https://camo.githubusercontent.com/418ab47949a99f77f5f053ec953705a2c951ec292e3308fb48376e0f7531a976/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f626f72697367756572792f5048505472616e7369656e744661756c7448616e646c696e672e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/borisguery/PHPTransientFaultHandling/code-structure)[![Quality Score](https://camo.githubusercontent.com/04d4bc1a83cce7b6acb13af1f4939303a97cc02f8d35c8b2e612b2a21ed83ef0/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f626f72697367756572792f5048505472616e7369656e744661756c7448616e646c696e672f6261646765732f7175616c6974792d73636f72652e706e673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/borisguery/PHPTransientFaultHandling)[![Total Downloads](https://camo.githubusercontent.com/e237dcbeb541532743e390abf53e3844487a67081791f568197e7ec06d360c8b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f626f72697367756572792f7472616e7369656e742d6572726f722d68616e646c696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/borisguery/PHPTransientFaultHandling)

Provide a way to easily retry actions on transient errors / exceptions such as a network failure.

Install
-------

[](#install)

Via Composer

```
$ composer require borisguery/transient-error-handling
```

Usage
-----

[](#usage)

```
use Bgy\TransientFaultHandling\RetryStrategies\FixedInterval;
use Bgy\TransientFaultHandling\RetryPolicy;
use Bgy\TransientFaultHandling\ErrorDetectionStrategies\TransientErrorCatchAllStrategy;

$retryCount = 10;
$retryIntervalInMicroseconds = 1000000 // 1 sec
$retryStrategy = new FixedInterval($retryCount, $retryIntervalInMicroseconds);
$errorDetectionStrategy = new TransientErrorCatchAllStrategy(); // You may want to implement your own

$retryPolicy = new RetryPolicy($errorDetectionStrategy, $retryStrategy);
$retryPolicy->execute(function() {
    // try to connect to MySQL
    throw new ConnectionError("Unable to connect to MySQL");
});

// This configuration will try to execute 10 times the function everyseconds if an exception is thrown.
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Credits
-------

[](#credits)

- [Boris Guéry](https://github.com/borisguery)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance53

Moderate activity, may be stable

Popularity35

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~414 days

Recently: every ~182 days

Total

6

Last Release

1342d ago

PHP version history (3 changes)0.1PHP ^7.0

0.2PHP ^7.3

0.5PHP ^7.3||^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/e697c30c60bfd1c329e9661645ba5a79dd62d6375e48656b9ba9eaf54fd59956?d=identicon)[borisguery](/maintainers/borisguery)

---

Top Contributors

[![borisguery](https://avatars.githubusercontent.com/u/345495?v=4)](https://github.com/borisguery "borisguery (12 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/borisguery-transient-error-handling/health.svg)

```
[![Health](https://phpackages.com/badges/borisguery-transient-error-handling/health.svg)](https://phpackages.com/packages/borisguery-transient-error-handling)
```

###  Alternatives

[morilog/jalali

This Package helps developers to easily work with Jalali (Shamsi or Iranian) dates in PHP applications, based on Jalali (Shamsi) DateTime class.

9201.2M45](/packages/morilog-jalali)[bruli/php-git-hooks

Git hooks for PHP projects.

675370.8k5](/packages/bruli-php-git-hooks)[nikolaposa/version

Value Object that represents a SemVer-compliant version number.

1406.4M16](/packages/nikolaposa-version)[prooph/common

Common classes used across prooph packages

852.2M27](/packages/prooph-common)[funeralzone/valueobjects

A PHP 7.1 value objects helper library.

66643.3k22](/packages/funeralzone-valueobjects)[tomasnorre/crawler

Crawler extension for TYPO3

58397.5k1](/packages/tomasnorre-crawler)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
