PHPackages                             mcprohosting/retry - 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. mcprohosting/retry

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

mcprohosting/retry
==================

while (!$success) { tryAgain(); }

1.0.0(11y ago)071MITPHP

Since May 30Pushed 11y ago17 watchersCompare

[ Source](https://github.com/MCProHosting/retry)[ Packagist](https://packagist.org/packages/mcprohosting/retry)[ RSS](/packages/mcprohosting-retry/feed)WikiDiscussions master Synced 6d ago

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

retry
=====

[](#retry)

Retry is a useful class to allow you to retry tasks until they work, optionally setting a delay between iterations, including flexible conditioning and readable syntax.

[![RETRY](https://camo.githubusercontent.com/862c58fb1d7a27615d5e11e01c4e5b16edc81754dda2b7518bfca2e61ccd142e/687474703a2f2f63646e2e736d6f73682e636f6d2f73697465732f64656661756c742f66696c65732f626c6f6775706c6f6164732f63776f6c662d32322e6a7067)](https://camo.githubusercontent.com/862c58fb1d7a27615d5e11e01c4e5b16edc81754dda2b7518bfca2e61ccd142e/687474703a2f2f63646e2e736d6f73682e636f6d2f73697465732f64656661756c742f66696c65732f626c6f6775706c6f6164732f63776f6c662d32322e6a7067)

Usage
-----

[](#usage)

```
// This retries running the given function until "working" is returned. It retries
// up to ten times, pausing for 1000 ms (one second) in between attempts.

Retry::running(function () {
    if (doSomething()) {
        return 'working';
    } else {
        return 'broken';
    }
})->whileIsnt('working')
  ->delay(1000)
  ->go(10);

// Passing a callable in "soLongAs" allows you to transform the output before
// testing its value. Retry will also return the last value gotten from
// running(), if it did ever succeed, or the boolean false if it did not.

$arrayThing = Retry::running(function () {
    return complicatedArrayThing();
})->soLongAs(function ($arrayThing) {
    return !! $arrayThing;
})->is(false)->go(5);

if ($arrayThing === false) {
    echo "We're out of ArrayThings today!";
} else {
    echo "Here's your ArrayThing!";
    var_dump($arrayThing);
}
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

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

Total

2

Last Release

4371d ago

Major Versions

0.0.1 → 1.0.02014-05-30

### Community

Maintainers

![](https://www.gravatar.com/avatar/6375a3210e43e05516fd8ffa377cec01888a6c3c4e4ce4130cbd0f7c0eeb0a02?d=identicon)[connor4312](/maintainers/connor4312)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mcprohosting-retry/health.svg)

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

###  Alternatives

[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[sllh/composer-versions-check

Checks if packages are up to date to last major versions after update

2352.4M16](/packages/sllh-composer-versions-check)[verbb/buttonbox

A collection of utility field types.

8963.7k1](/packages/verbb-buttonbox)[overtrue/php-opencc

中文简繁转换，支持词汇级别的转换、异体字转换和地区习惯用词转换（中国大陆、台湾、香港、日本新字体）。基于 \[BYVoid/OpenCC\](https://github.com/BYVoid/OpenCC) 数据实现。

12130.7k](/packages/overtrue-php-opencc)[opensoft/rollout-bundle

A Symfony2/3/4 Bundle for opensoft/rollout

42122.0k](/packages/opensoft-rollout-bundle)[armincms/json

A Laravel Nova field.

25149.4k3](/packages/armincms-json)

PHPackages © 2026

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