PHPackages                             yireo/magento2-graph-ql-rate-limiting - 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. [API Development](/categories/api)
4. /
5. yireo/magento2-graph-ql-rate-limiting

ActiveMagento2-module[API Development](/categories/api)

yireo/magento2-graph-ql-rate-limiting
=====================================

Magento 2 module to add rate limiting to GraphQL resources

0.0.5(2y ago)1419.8k↓33.3%4[1 issues](https://github.com/yireo/Yireo_GraphQlRateLimiting/issues)[1 PRs](https://github.com/yireo/Yireo_GraphQlRateLimiting/pulls)OSL-3.0PHPPHP 7.4.\*

Since Apr 18Pushed 2y ago1 watchersCompare

[ Source](https://github.com/yireo/Yireo_GraphQlRateLimiting)[ Packagist](https://packagist.org/packages/yireo/magento2-graph-ql-rate-limiting)[ Docs](https://github.com/yireo/Yireo_GraphQlRateLimiting)[ Fund](https://www.paypal.me/yireo)[ GitHub Sponsors](https://github.com/yireo)[ RSS](/packages/yireo-magento2-graph-ql-rate-limiting/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (8)Versions (7)Used By (0)

Yireo GraphQlRateLimiting
=========================

[](#yireo-graphqlratelimiting)

**Magento 2 module to add rate limiting to GraphQL resources**

**WARNING: As of yet, the sunspikes/php-ratelimiter library is no longer being maintained. And because of this, this module is dead, until it is refactored to use another rate limiting tool.**

This module implements the [sunspikes/php-ratelimiter](https://packagist.org/packages/sunspikes/php-ratelimiter) in Magento 2. It checks how many GraphQL mutations and/or GraphQL queries are sent from a specific client to a Magento instance and if the number of these requests exceeds a configured maximum, a GraphQL error is generated.

This module is specifically recommended for limiting mutations, so that your Magento shop is not flooded with fake requests to create sessions, customers or other data. Usually, in a headless environment, the amount of mutations is limited.

Usage
-----

[](#usage)

Install this extension:

```
composer require yireo/magento2-graph-ql-rate-limiting
bin/magento module:enable Yireo_GraphQlRateLimiting
bin/magento setup:upgrade

```

Next, login to the Magento Admin Panel, navigate to **Store Configuration** and then **Yireo &gt; Yireo GraphQlRateLimiting &gt; Settings** and modify the settings to your needs. The default might be fine though. The settings **Enabled** and **Limit Mutations** are definitely to be enabled, otherwise this extension is kind of pointless. Whether **Limit Queries** is useful up to you. The settings **Maximum Queries** and **Maximum Mutations** refer to the maximum amount of queries or mutations to be made within a certain timeframe (**Timeframe**) before a connection is denied for the remainder of that timeframe.

Finally, navigate to **Cache Management** and enable the cache **GraphQL Rate Limiting**:

```
bin/magento cache:enable graphql_rate_limiting

```

Testing to see if this works
----------------------------

[](#testing-to-see-if-this-works)

Open up GraphiQL or some other client and create a simple request like the following:

```
query {
  products(filter: {name: {match: "jacket"}}) {
    items {
      sku
    }
  }
}
```

Configure the following settings in this Magento module (under the **Store Configuration**):

- **Enabled**: *Yes*
- **Limit Queries**: *Yes*
- **Maximum Queries**: *3*

After running the same query three-times an error should popup up:

```
{
  "errors": [
    {
      "message": "A maximum of 3 queries has been reached.",
      "extensions": {
        "category": "graphql"
      }
    }
  ]
}
```

Testing of the cache type
-------------------------

[](#testing-of-the-cache-type)

This extension adds a Cache Type `GRAPHQL_RATE_LIMITING` to the Magento cache frontends. To test whether the Cache Type is working, you can run the following Functional Test:

```
bin/magento cache:status
bin/magento cache:enable graphql_rate_limiting
vendor/bin/phpunit --bootstrap=app/bootstrap.php app/code/Yireo/GraphQlRateLimiting/Test/Functional/CacheTypeTest.php
```

Other functional tests
----------------------

[](#other-functional-tests)

To run other functional tests, the following can be used:

```
bin/magento cache:enable graphql_rate_limiting
vendor/bin/phpunit --bootstrap=app/bootstrap.php app/code/Yireo/GraphQlRateLimiting/Test/Functional/
```

Please note that this resets your configuration. Do not do this on a live Magento site.

Todo
----

[](#todo)

- Make compatible with PHP 8
- Allow saving data in Redis
- Check what Adobe Commerce uses for `backpressure-logger`
- Add integation tests
- Add `MovingWindowSettings` and `FixedWindowSettings`
- Allow for specific endpoints to be limited
- Make sure to reply with HTTP/1.1 429 Too Many Requests

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity36

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

Total

5

Last Release

766d ago

PHP version history (2 changes)0.0.4PHP 7.4

0.0.5PHP 7.4.\*

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1373981?v=4)[Yireo](/maintainers/yireo)[@yireo](https://github.com/yireo)

---

Top Contributors

[![jissereitsma](https://avatars.githubusercontent.com/u/7670482?v=4)](https://github.com/jissereitsma "jissereitsma (56 commits)")

---

Tags

magento2-modulemagentocomposer-installer

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/yireo-magento2-graph-ql-rate-limiting/health.svg)

```
[![Health](https://phpackages.com/badges/yireo-magento2-graph-ql-rate-limiting/health.svg)](https://phpackages.com/packages/yireo-magento2-graph-ql-rate-limiting)
```

###  Alternatives

[smile/elasticsuite

Magento 2 merchandising and search engine built on ElasticSearch

8044.5M33](/packages/smile-elasticsuite)[mollie/magento2

Mollie Payment Module for Magento 2

1121.6M10](/packages/mollie-magento2)[yireo/magento2-googletagmanager2

Add Google Tag Manager to Magento

167930.4k5](/packages/yireo-magento2-googletagmanager2)[yireo/magento2-checkouttester2

Checkout Tester for Magento 2

93477.4k1](/packages/yireo-magento2-checkouttester2)[yireo/magento2-emailtester2

Preview transactional emails and test send them in your backend

33394.9k](/packages/yireo-magento2-emailtester2)[yireo/magento2-additional-endpoints-graph-ql

113.0k](/packages/yireo-magento2-additional-endpoints-graph-ql)

PHPackages © 2026

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