PHPackages                             poor-plebs/guzzle-connect-retry-decider - 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. poor-plebs/guzzle-connect-retry-decider

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

poor-plebs/guzzle-connect-retry-decider
=======================================

A guzzle retry middleware decider that re-attempts requests whenever a connection fails to be established. Always retries up to x times for GET requests and under specific conditions also for other HTTP methods.

1.1.2(2y ago)23.1k↑950%[4 PRs](https://github.com/Poor-Plebs/guzzle-connect-retry-decider/pulls)2MITPHPPHP ^8.1.0

Since Dec 18Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/Poor-Plebs/guzzle-connect-retry-decider)[ Packagist](https://packagist.org/packages/poor-plebs/guzzle-connect-retry-decider)[ RSS](/packages/poor-plebs-guzzle-connect-retry-decider/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (6)Versions (9)Used By (2)

poor-plebs/guzzle-connect-retry-decider
=======================================

[](#poor-plebsguzzle-connect-retry-decider)

[![CI](https://github.com/Poor-Plebs/guzzle-connect-retry-decider/actions/workflows/ci.yml/badge.svg)](https://github.com/Poor-Plebs/guzzle-connect-retry-decider/actions/workflows/ci.yml)

**[What is it for?](#what-is-it-for)** | **[What are the requirements?](#what-are-the-requirements)** | **[How to install it?](#how-to-install-it)** | **[How to use it?](#how-to-use-it)** | **[How to contribute?](#how-to-contribute)**

A guzzle retry middleware decider that re-attempts requests whenever a connection fails to be established. Always retries up to x times for GET requests and under specific conditions also for other HTTP methods.

What is it for?
---------------

[](#what-is-it-for)

To be more resilient against all kind of connectivity issues, it is a good practice to just simply retry the request. The guzzle http package already comes with a generic retry middleware out of the box that accepts a decider callable.

This package provides a decider that will re attempt a request up to x times when ever a guzzle connect exception is thrown. For GET requests, the decider will always retry. For other HTTP methods, the decider will only retry, when no connection could be established yet (no data sent and for HTTPS no handshake done) to prevent potential double send incidents.

What are the requirements?
--------------------------

[](#what-are-the-requirements)

- PHP 8.1 or above

How to install it?
------------------

[](#how-to-install-it)

```
composer require poor-plebs/guzzle-connect-retry-decider
```

How to use it?
--------------

[](#how-to-use-it)

```
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;

$handlerStack = HandlerStack::create();

// Where to put this middleware in the middleware stack depends on your usecase.
// Usually just before the handler on top or before a log middleware.
$handlerStack->push(
    Middleware::retry(new ConnectRetryDecider(
        maxRetries: 3,
        onBeforeRetry: function (
            int $retries,
            RequestInterface $request,
            Throwable $exception
        ): void {
            /* Optional closure that is executed just before the retry is done.
             * At this point it is already decided that we will retry.
             *
             * Can be used to log the following retry or do some other action.
             */
        }
    )),
    'connect_retry',
);

$client = new Client([
    'base_uri' => 'https://sometest.com/',
    'handler' => $handlerStack,
]);

$client->getAsync('information')->wait();
```

The `maxRetries` and `onBeforeRetry` are both optional. Max retries defaults to 3 retries. If provided, the `onBeforeRetry` will be executed right before a retry. The callback receives the number of retries already done, the request instance and the exception that caused the previous attempt to fail.

How to contribute?
------------------

[](#how-to-contribute)

`poor-plebs/guzzle-connect-retry-decider` follows semantic versioning. Read more on [semver.org](https://semver.org).

Create issues to report problems or requests. Fork and create pull requests to propose solutions and ideas. Always add a CHANGELOG.md entry in the unreleased section.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance56

Moderate activity, may be stable

Popularity25

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 63.4% 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 ~56 days

Total

4

Last Release

1071d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7612582?v=4)[Petr Levtonov](/maintainers/TheLevti)[@TheLevti](https://github.com/TheLevti)

---

Top Contributors

[![TheLevti](https://avatars.githubusercontent.com/u/7612582?v=4)](https://github.com/TheLevti "TheLevti (26 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (15 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/poor-plebs-guzzle-connect-retry-decider/health.svg)

```
[![Health](https://phpackages.com/badges/poor-plebs-guzzle-connect-retry-decider/health.svg)](https://phpackages.com/packages/poor-plebs-guzzle-connect-retry-decider)
```

###  Alternatives

[shopify/shopify-api

Shopify API Library for PHP

4634.8M16](/packages/shopify-shopify-api)[neuron-core/neuron-ai

The PHP Agentic Framework.

1.8k245.3k21](/packages/neuron-core-neuron-ai)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[huaweicloud/huaweicloud-sdk-php

Huawei Cloud SDK for PHP

1829.2k2](/packages/huaweicloud-huaweicloud-sdk-php)[mimmi20/browser-detector

Library to detect Browsers and Devices

48153.5k3](/packages/mimmi20-browser-detector)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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