PHPackages                             vectorifyai/guzzle-rate-limiter - 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. vectorifyai/guzzle-rate-limiter

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

vectorifyai/guzzle-rate-limiter
===============================

Guzzle middleware for preventive rate limiting with multi-store support, progressive delays, and cross-process coordination.

1.0.2(9mo ago)55.7k1MITPHPPHP ^8.2CI passing

Since Jul 8Pushed 9mo agoCompare

[ Source](https://github.com/vectorifyai/guzzle-rate-limiter)[ Packagist](https://packagist.org/packages/vectorifyai/guzzle-rate-limiter)[ RSS](/packages/vectorifyai-guzzle-rate-limiter/feed)WikiDiscussions main Synced 1mo ago

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

Rate limiter middleware for Guzzle
==================================

[](#rate-limiter-middleware-for-guzzle)

[![Latest Version](https://camo.githubusercontent.com/17dbbc8a258cc27447ad1b97fe666131e393284015f69bb701f5ff352f10aa2d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f766563746f7269667961692f67757a7a6c652d726174652d6c696d697465722e7376673f6c6162656c3d6c6174657374267374796c653d666c6174)](https://packagist.org/packages/vectorifyai/guzzle-rate-limiter)[![Total Downloads](https://camo.githubusercontent.com/1e4fdd90d140377ba971fbd7f312753e8994635bca29008a6e58f171029b7cda/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f766563746f7269667961692f67757a7a6c652d726174652d6c696d697465722e7376673f7374796c653d666c6174)](https://packagist.org/packages/vectorifyai/guzzle-rate-limiter)[![Tests](https://camo.githubusercontent.com/38435b1251704f1a1f204b86d96492a8f482212c99a8a2a297bb598027c02c7c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f766563746f7269667961692f67757a7a6c652d726174652d6c696d697465722f74657374732e796d6c3f6c6162656c3d7465737473267374796c653d666c6174)](https://github.com/vectorifyai/guzzle-rate-limiter/actions/workflows/tests.yml)[![License](https://camo.githubusercontent.com/da7f2b44953a7ba0c1e5c0cc7c09c5e69b8a1e483f904a39a2c8e73e78353d62/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f766563746f7269667961692f67757a7a6c652d726174652d6c696d697465722e7376673f7374796c653d666c6174)](LICENSE.md)

A sophisticated `Guzzle` middleware for preventive rate limiting with multi-store support, progressive delays, and cross-process coordination. It works in accordance with the [IETF standard](https://datatracker.ietf.org/doc/html/draft-ietf-httpapi-ratelimit-headers) by using the `X-RateLimit-Remaining` (number of requests remaining in the current rate limit window) and `Retry-After` (number of seconds to wait before retrying the request again) values available in the response headers.

Features
--------

[](#features)

- **Intelligent Rate Limiting**: Progressive delays based on remaining API quota
- **Multi-Store Support**: InMemory, Laravel Cache, Symfony Cache, Filesystem, and more
- **Cross-Process Coordination**: Share rate limit state across multiple processes (i.e. queue jobs)
- **Automatic Recovery**: Handles 429 responses with exponential backoff
- **Flexible Configuration**: Customizable thresholds and delays
- **PSR-3 Logging**: Built-in logging with configurable levels

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

[](#installation)

```
composer require vectorifyai/guzzle-rate-limiter
```

Quick Start
-----------

[](#quick-start)

```
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
use Vectorify\GuzzleRateLimiter\RateLimiterMiddleware;
use Vectorify\GuzzleRateLimiter\Stores\InMemoryStore;

$stack = HandlerStack::create();
$stack->push(new RateLimiterMiddleware(new InMemoryStore));

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

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

```
use Vectorify\GuzzleRateLimiter\RateLimiterMiddleware;
use Vectorify\GuzzleRateLimiter\Stores\InMemoryStore;

$middleware = new RateLimiterMiddleware(new InMemoryStore);
```

### Laravel Integration

[](#laravel-integration)

```
use Vectorify\GuzzleRateLimiter\Stores\LaravelStore;

$store = new LaravelStore(cache(), 'api:rate_limit');
$middleware = new RateLimiterMiddleware($store);
```

### Symfony Integration

[](#symfony-integration)

```
use Vectorify\GuzzleRateLimiter\Stores\SymfonyStore;
use Symfony\Component\Cache\Adapter\RedisAdapter;

$cache = new RedisAdapter(/* redis client */);
$store = new SymfonyStore($cache, 'api:rate_limit');
$middleware = new RateLimiterMiddleware($store);
```

### Filesystem Integration

[](#filesystem-integration)

```
use Vectorify\GuzzleRateLimiter\Stores\FilesystemStore;
use League\Flysystem\Local\LocalFilesystemAdapter;

// Local filesystem
$adapter = new LocalFilesystemAdapter('/path/to/cache');
$store = new FilesystemStore($adapter);
$middleware = new RateLimiterMiddleware($store);

// AWS S3
use League\Flysystem\AwsS3V3\AwsS3V3Adapter;
$s3Adapter = new AwsS3V3Adapter($s3Client, $bucket, $prefix);
$store = new FilesystemStore($s3Adapter);

// SFTP
use League\Flysystem\PhpseclibV3\SftpAdapter;
$sftpAdapter = new SftpAdapter(/* SFTP connection settings */);
$store = new FilesystemStore($sftpAdapter);
```

### Advanced Configuration

[](#advanced-configuration)

```
$middleware = new RateLimiterMiddleware(
    store: new InMemoryStore,
    cachePrefix: 'my_api:rate_limit',
    logger: $customLogger,
);
```

Changelog
---------

[](#changelog)

Please see [Releases](../../releases) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Pull requests are more than welcome. You must follow the PSR coding standards.

Security
--------

[](#security)

Please review [our security policy](https://github.com/vectorifyai/guzzle-rate-limiter/security/policy) on how to report security vulnerabilities.

License
-------

[](#license)

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

###  Health Score

38

—

LowBetter than 84% of packages

Maintenance58

Moderate activity, may be stable

Popularity23

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

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

Total

3

Last Release

295d ago

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/9ca06c358f37f03d22661c4260bbc12ca3e96057c0d6f6417f4e04d54522ac49?d=identicon)[emilyhendon](/maintainers/emilyhendon)

---

Top Contributors

[![emilyhendon](https://avatars.githubusercontent.com/u/202198324?v=4)](https://github.com/emilyhendon "emilyhendon (6 commits)")

---

Tags

guzzlemiddlewarerate-limiterrate-limitingphpmiddlewareapisymfonylaravelGuzzlecacherate limiting

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vectorifyai-guzzle-rate-limiter/health.svg)

```
[![Health](https://phpackages.com/badges/vectorifyai-guzzle-rate-limiter/health.svg)](https://phpackages.com/packages/vectorifyai-guzzle-rate-limiter)
```

###  Alternatives

[kevinrob/guzzle-cache-middleware

A HTTP/1.1 Cache for Guzzle 6. It's a simple Middleware to be added in the HandlerStack. (RFC 7234)

43117.4M104](/packages/kevinrob-guzzle-cache-middleware)[hamburgscleanest/guzzle-advanced-throttle

A Guzzle middleware that can throttle requests according to (multiple) defined rules. It is also possible to define a caching strategy, e.g. get response from cache when rate limit is exceeded or always get cached value to spare your rate limits.

13033.4k1](/packages/hamburgscleanest-guzzle-advanced-throttle)[hamburgscleanest/laravel-guzzle-throttle

A Laravel wrapper for https://github.com/hamburgscleanest/guzzle-advanced-throttle.

7914.3k](/packages/hamburgscleanest-laravel-guzzle-throttle)[brightfish/caching-guzzle

Cache HTTP responses through Guzzle middleware

1031.5k](/packages/brightfish-caching-guzzle)[huaweicloud/huaweicloud-sdk-php

Huawei Cloud SDK for PHP

1829.2k2](/packages/huaweicloud-huaweicloud-sdk-php)[pingpong/facebook

Facebook OAuth v4 for Laravel Framework

1129.7k](/packages/pingpong-facebook)

PHPackages © 2026

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