PHPackages                             zarganwar/failure-retry-executor - 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. zarganwar/failure-retry-executor

ActiveLibrary

zarganwar/failure-retry-executor
================================

Retry failed operations

0.1.4(2y ago)1263↑500%PHPPHP &gt;=8.1

Since Oct 16Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Zarganwar/failure-retry-executor)[ Packagist](https://packagist.org/packages/zarganwar/failure-retry-executor)[ Docs](https://github.com/Zarganwar/failure-retry-executor)[ RSS](/packages/zarganwar-failure-retry-executor/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (6)Used By (0)

failure-retry-executor
======================

[](#failure-retry-executor)

Usage
=====

[](#usage)

Simply run function `Zarganwar\FailureRetryExecutor\FailureRetryExecutor::execute()` with your command as first argument

```
Zarganwar\FailureRetryExecutor\FailureRetryExecutor::execute(fn() => someFunction());
```

Your function will be executed and if it fails (throws an Exception or returns false), it will be executed again. Max. default retries is 3. Of course, you can change it by passing `maxAttempts: int` argument.

```
Zarganwar\FailureRetryExecutor\FailureRetryExecutor::execute(
    command: fn() => someFunction(),
    maxAttempts: 99,
);
```

You can also respond to the command result or failure by passing `onSuccess: callable` or/and `onFailure: callable` arguments.

```
Zarganwar\FailureRetryExecutor\FailureRetryExecutor::execute(
    command: fn() => someFunction(),
    onSuccess: fn($result /* Your callable command result */) => doSomething($result),
    onFailure: fn(Throwable $throwable) => log($throwable),
);
```

Example of usage:

```
// Some HTTP client
$client = new Client();
$logger = new Logger();

Zarganwar\FailureRetryExecutor\FailureRetryExecutor::execute(
    command: fn() => $client->get('https://example.com'),
    onSuccess: function(ResponseInterface $response): void
    {
        if ($response->getStatusCode() !== 200) {
            throw new Exception("Server responded with status code {$response->getStatusCode()} instead of 200");
        }
    },
    onFailure: fn(Throwable $throwable) => $logger->log($throwable),
    maxAttempts: 5,
);
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 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 ~20 days

Total

5

Last Release

855d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2104391d837ea66c6936507b546bded99e9f036a5737d6b694712726506bed34?d=identicon)[Zarganwar](/maintainers/Zarganwar)

---

Top Contributors

[![Zarganwar](https://avatars.githubusercontent.com/u/8614429?v=4)](https://github.com/Zarganwar "Zarganwar (9 commits)")

### Embed Badge

![Health badge](/badges/zarganwar-failure-retry-executor/health.svg)

```
[![Health](https://phpackages.com/badges/zarganwar-failure-retry-executor/health.svg)](https://phpackages.com/packages/zarganwar-failure-retry-executor)
```

PHPackages © 2026

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