PHPackages                             perimeter/rate-limiter-php - 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. [Caching](/categories/caching)
4. /
5. perimeter/rate-limiter-php

ActiveLibrary[Caching](/categories/caching)

perimeter/rate-limiter-php
==========================

A very simple Rate Limiter for PHP

v0.1.1(11y ago)1715.4k1MITPHPPHP &gt;=5.3.0

Since Mar 31Pushed 10y ago3 watchersCompare

[ Source](https://github.com/perimeter/rate-limiter-php)[ Packagist](https://packagist.org/packages/perimeter/rate-limiter-php)[ Docs](http://github.com/perimeter/rate-limiter-php)[ RSS](/packages/perimeter-rate-limiter-php/feed)WikiDiscussions develop Synced 1mo ago

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

Perimeter RateLimiter
=====================

[](#perimeter-ratelimiter)

[![Build Status](https://camo.githubusercontent.com/6d219baa6df83e1d34244b4b23be5a9c5a964540a76b7510b643a99c9e37d3b5/68747470733a2f2f7472617669732d63692e6f72672f706572696d657465722f726174652d6c696d697465722d7068702e7376673f6272616e63683d646576656c6f70)](https://travis-ci.org/perimeter/rate-limiter-php)

Rate Limit those APIs!

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

[](#installation)

```
$ composer.phar require perimeter/rate-limiter-php:dev-develop

```

> This library can be used alongside the [perimeter/RateLimitBundle](https://github.com/perimeter/RateLimitBundle) for Symfony2 applications. See the repository for more instructions.

Get Started
-----------

[](#get-started)

Create your throttler:

```
include_once('vendor/autoload.php');

$redis = new Predis\Client();
$throttler = new Perimeter\RateLimiter\Throttler\RedisThrottler($redis);
```

Ensure redis is running by executing the `redis-server` command on the web server where the library is running:

```
$ redis-server

```

Now you can throttle your users accordingly!

```
// Create a meter ID based on something unique to your user
// In this case we use the IP. This can also be a username,
// company, or some other authenticated property
$meterId = sprintf('ip_address:%s', $_SERVER['REMOTE_ADDR']);
$warnThreshold = 10;
$limitThreshold = 20;

// run the "consume" command
$throttler->consume($meterId, $warnThreshold, $limitThreshold);

if ($throttler->isLimitWarning()) {
    echo "slow down!";
}

if ($throttler->isLimitExceeded()) {
    exit("you have been rate limited");
}
```

And that's it!

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% 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 ~0 days

Total

2

Last Release

4066d ago

### Community

Maintainers

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

---

Top Contributors

[![bshaffer](https://avatars.githubusercontent.com/u/103941?v=4)](https://github.com/bshaffer "bshaffer (8 commits)")[![rubberpants](https://avatars.githubusercontent.com/u/1185393?v=4)](https://github.com/rubberpants "rubberpants (2 commits)")

---

Tags

apiredisratelimitapi-gatewayperimeter

### Embed Badge

![Health badge](/badges/perimeter-rate-limiter-php/health.svg)

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

###  Alternatives

[monospice/laravel-redis-sentinel-drivers

Redis Sentinel integration for Laravel and Lumen.

103830.5k](/packages/monospice-laravel-redis-sentinel-drivers)[symfony-bundles/redis-bundle

Symfony Redis Bundle

271.1M5](/packages/symfony-bundles-redis-bundle)[pdffiller/qless-php

PHP Bindings for qless

29113.2k1](/packages/pdffiller-qless-php)[perimeter/rate-limit-bundle

Perimeter RateLimitBundle

411.5k](/packages/perimeter-rate-limit-bundle)

PHPackages © 2026

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