PHPackages                             pno/throttle - 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. pno/throttle

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

pno/throttle
============

StackPHP compatible class for throttling HTTP requests using Predis. Based on datagraph/rack-throttle.

141802PHP

Since Sep 28Pushed 11y ago2 watchersCompare

[ Source](https://github.com/penoonan/throttle)[ Packagist](https://packagist.org/packages/pno/throttle)[ RSS](/packages/pno-throttle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

\#Throttle

Throttle is a [StackPHP](http://www.stackphp.com) middleware for limiting how often individual IPs can make requests to an application. It's very simple and loosely inspired by Ruby / Rack's [datagraph/rack-throttle](https://github.com/datagraph/rack-throttle) library.

Throttle can only use Predis at the moment. I would like to write some adapters to allow the use of other clients soon.

Sample usage with a Silex App:

```
    require_once __DIR__.'/../vendor/autoload.php';

    $app = new \Silex\Application();

    $stack = (new Stack\Builder())
	    ->push('pno\Throttle', new \Predis\Client());

    $app = $stack->resolve($app);
```

It works by tracking the number of requests that come from a particular IP during a given interval of time. The default limit is 360 requests per 3600 seconds - i.e., one request per 10 seconds for each hour. If an IP has hit the limit, Throttle responds by sending a Symfony 403 response with the message "Rate limit exceeded".

You can override any of those defaults by passing them to Throttle's constructor.

If you're using the Stack\\Builder class to apply your middlewares, and you would like to limit IPs to 2 requests every 10 seconds, and give a more colorful response message, you could do something like this:

```
    $response = new Symfony\Component\HttpFoundation\Response('STAY OFF MY LAWN!!! >:(', 403);
    $stack = (new Stack\Builder())
        ->push('pno\Throttle', new Predis\Client(), 2, 10, $response);
```

And ah yes, lest I forget: this has been added to packagist, for the convenience, wonder and bemusement of all:

- "pno/throttle": "dev-master"

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

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

---

Top Contributors

[![penoonan](https://avatars.githubusercontent.com/u/1959257?v=4)](https://github.com/penoonan "penoonan (2 commits)")

### Embed Badge

![Health badge](/badges/pno-throttle/health.svg)

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

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M317](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M292](/packages/pusher-pusher-php-server)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)

PHPackages © 2026

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