PHPackages                             compwright/should-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. [HTTP &amp; Networking](/categories/http)
4. /
5. compwright/should-retry

ActiveLibrary[HTTP &amp; Networking](/categories/http)

compwright/should-retry
=======================

PSR interop HTTP retry middleware helper

v1.0.0(1y ago)15.2k↓47.2%2MITPHPPHP ^8.1 || ^8.2 || ^8.3 || ^8.4CI passing

Since Mar 14Pushed 1y ago1 watchersCompare

[ Source](https://github.com/compwright/should-retry)[ Packagist](https://packagist.org/packages/compwright/should-retry)[ Docs](https://github.com/compwright/should-retry)[ RSS](/packages/compwright-should-retry/feed)WikiDiscussions master Synced today

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

compwright/should-retry
=======================

[](#compwrightshould-retry)

Installation
------------

[](#installation)

```
$ composer require compwright/should-retry

```

Usage with Guzzle HTTP library
------------------------------

[](#usage-with-guzzle-http-library)

The popular Guzzle HTTP library includes a retry middleware:

```
use Compwright\ShouldRetry\ShouldRetry;
use Compwright\ShouldRetry\RetryAfter;

$handler = GuzzleHttp\HandlerStack::create();

$handler->push(
    GuzzleHttp\Middleware::retry(
        new ShouldRetry(),
        new RetryAfter()
    ),
    'retry'
);

$client = new GuzzleHttp\Client([
    'handler' => $handler,
]);
```

Configuration
-------------

[](#configuration)

Both ShouldRetry and RetryAfter are configurable via setters:

```
$shouldRetry = (new ShouldRetry())
    ->setMaxRetries(5)
    ->setRetryOnStatusCodes(429)
    ->setLogger($logger); // attach PSR-3 debug logger

$retryAfter = (new RetryAfter())
    ->setRetryAfterHeader('x-rate-limit-reset')
    ->setFallbackStrategy($fallback);
```

Default configuration:

- Retry up to 3 times
- Retry on 429, 500, 502, 503, 504 error codes
- When retrying, wait `Retry-After` seconds
- If header is missing, use exponential backoff

License
-------

[](#license)

MIT License

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance42

Moderate activity, may be stable

Popularity25

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity56

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

Unknown

Total

1

Last Release

476d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/138688?v=4)[Jonathon Hill](/maintainers/compwright)[@compwright](https://github.com/compwright)

---

Top Contributors

[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

psr-7Guzzlepsr-15

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[cakephp/cakephp

The CakePHP framework

8.9k19.5M1.8k](/packages/cakephp-cakephp)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M738](/packages/sylius-sylius)[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

35789.4k2](/packages/telnyx-telnyx-php)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)

PHPackages © 2026

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