PHPackages                             sndsgd/rate - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. sndsgd/rate

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sndsgd/rate
===========

Rate limiting for PHP

0.1.2(9y ago)1363MITPHPPHP &gt;=7.0.0

Since Jun 30Pushed 9y ago1 watchersCompare

[ Source](https://github.com/sndsgd/rate)[ Packagist](https://packagist.org/packages/sndsgd/rate)[ Docs](https://github.com/sndsgd/rate)[ RSS](/packages/sndsgd-rate/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (3)Dependencies (3)Versions (5)Used By (0)

sndsgd/rate
===========

[](#sndsgdrate)

[![Latest Version](https://camo.githubusercontent.com/fc7da372d1d2290eebfc53ae5cc7780bbbaaac813ee9387393f5effecdbb1f73/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f736e647367642f726174652e7376673f7374796c653d666c61742d737175617265)](https://github.com/sndsgd/rate/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/sndsgd/rate/LICENSE)[![Build Status](https://camo.githubusercontent.com/bfbf19d064a61854ae7b6fde2da54eb1e94a6ffc6d320aba01dcbd50a61cdd0e/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f736e647367642f726174652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/sndsgd/rate)[![Coverage Status](https://camo.githubusercontent.com/6c7686bd193fe104abafb498918912d410bde51aa458e6b01e5b20cc0686a9b4/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f736e647367642f726174652e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/r/sndsgd/rate?branch=master)[![Total Downloads](https://camo.githubusercontent.com/73d4068a185224c475f74727cf28cba7eece5b59b02fb261af52cfd2744e4d74/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736e647367642f726174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sndsgd/rate)

Rate limiting for PHP.

Requirements
------------

[](#requirements)

This project is unstable and subject to changes from release to release.

You need **PHP &gt;= 7.0** to use this library, however, the latest stable version of PHP is recommended.

Install
-------

[](#install)

Install `sndsgd/rate` using [Composer](https://getcomposer.org/).

Usage
-----

[](#usage)

> Note: At the moment, this library only contains rate limiting tools.

```
# define the rate limits
$clientIp = $di->getClient()->getIp();
$limits = [
    new \sndsgd\rate\Limit("Search-PerSecond", $clientIp, 1, 3),
    new \sndsgd\rate\Limit("Search-PerHour", $clientIp, 600, 3600),
];

# create a limiter, and increment the hit counts for all limits
$redis = $di->getRedis();
$limiter = new \sndsgd\rate\limiter\RedisLimiter($redis, $limits);
$limiter->increment();

# copy the rate limit headers to the response
$response = $di->getResponse();
foreach ($limiter->getHeaders() as $header) {
    list($key, $value) = preg_split("/\:\s?/", $header, 2);
    $response->addHeader($key, $value);
}

# if the limit was exceeded, prevent futher execution
if ($limiter->isExceeded()) {
    throw new \sndsgd\http\exception\TooManyRequestsException();
}
```

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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

Total

3

Last Release

3474d ago

### Community

Maintainers

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

---

Top Contributors

[![sndsgd](https://avatars.githubusercontent.com/u/5289973?v=4)](https://github.com/sndsgd "sndsgd (17 commits)")

### Embed Badge

![Health badge](/badges/sndsgd-rate/health.svg)

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

PHPackages © 2026

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