PHPackages                             sideshow\_bob/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. [Security](/categories/security)
4. /
5. sideshow\_bob/throttle

ActiveLibrary[Security](/categories/security)

sideshow\_bob/throttle
======================

Ban identifier after certain amount of requests in a given timeframe.

0.4.3(10y ago)010.4k↓83.3%1mitPHPPHP &gt;=5.4

Since Aug 8Pushed 10y ago1 watchersCompare

[ Source](https://github.com/sideshowcecil/throttle)[ Packagist](https://packagist.org/packages/sideshow_bob/throttle)[ RSS](/packages/sideshow-bob-throttle/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (6)Versions (11)Used By (0)

Throttle
========

[](#throttle)

Ban identifier after certain amount of requests in a given timeframe.

[![Build Status](https://camo.githubusercontent.com/9846ce2e8e2e6fdb453320906db77a37ab82a205b3e49505d9185472d17c33b1/68747470733a2f2f7472617669732d63692e6f72672f7369646573686f77636563696c2f7468726f74746c652e706e67)](https://travis-ci.org/sideshowcecil/throttle)

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

[](#installation)

The suggested installation method is via [composer](https://getcomposer.org/):

```
php composer.phar require "sideshow_bob/throttle"
```

Usage
-----

[](#usage)

Basic usage of the `Throttle` class to ban an identifier.

```
// ip
$identifier = $_SERVER["REMOTE_ADDR"];
// instantiate class
$throttle = new \sideshow_bob\Throttle(new \sideshow_bob\Storage\Memcached());

if($throttle->validate($identifier)) {
    // success proceed
} else {
    // banned
}
```

Storage
-------

[](#storage)

Included are `Array`, `Memcached`, `Redis`, `Predis` and `doctrine/cache` storage implementations, however it is very easy to use some other storage system just implement the *StorageInterface* and inject that object into the `Throttle` constructor.

\####*Caution*\#### Whatever storage system you decide to use, do not store the failed request data into your database, this could lead to a DDOS attack and take your database down.

Options
-------

[](#options)

You can override the default options by instantiating a `Throttle` class and pass in an *array* as the third argument.

```
$options = [
    "ban" => 10,      // ban identifier after 10 attempts. (default 5)
    "log" => 20,      // log identifier after 20 attempts. (default 10)
    "timespan" => 60, // the timespan for the duration of the ban. (default 86400)
];

// Instantiate class
$throttle = new \sideshow_bob\Throttle(new \sideshow_bob\Storage\Memcached(), $options);
```

Logger
------

[](#logger)

Any logger library that implements the [PSR-3](https://github.com/php-fig/log) *LoggerInterface* should work, just create your Logger object and inject it into the `Throttle` constructor. For example the excellent logging library [Monolog](https://github.com/seldaek/monolog).

Other Methods
-------------

[](#other-methods)

### reset()

[](#reset)

This will remove the identifier from the storage.

```
$throttle->reset($identifier);
```

### remaining()

[](#remaining)

This will return an integer that is the remaining attempt(s) available before identifier gets banned.

```
$throttle->remaining($identifier);
```

Testing
-------

[](#testing)

The test folder contains all tests.

Acknowledgement
---------------

[](#acknowledgement)

Forked from [websoftwares/throttle](https://github.com/websoftwares/Throttle).

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity54

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

Recently: every ~229 days

Total

10

Last Release

3787d ago

PHP version history (2 changes)0.1PHP &gt;=5.3.0

0.4.0PHP &gt;=5.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/b9081e4d54c467a06883ac5693582ad8b8cccfd0d3cc8b42f26eb0d23d24b793?d=identicon)[sideshow\_bob](/maintainers/sideshow_bob)

---

Top Contributors

[![BorisSimoni](https://avatars.githubusercontent.com/u/1969775?v=4)](https://github.com/BorisSimoni "BorisSimoni (3 commits)")

---

Tags

securityIPloginlimitRatethrottlebrute forceHammer

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[websoftwares/throttle

Ban identifier after certain amount of requests in a given timeframe.

1251.2k](/packages/websoftwares-throttle)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.6k38.2k](/packages/matomo-matomo)[maba/gentle-force-bundle

Symfony bundle that integrates gentle-force library for limiting both brute-force attempts and ordinary requests, using leaky/token bucket algorithm, based on Redis

51538.9k1](/packages/maba-gentle-force-bundle)[codeconsortium/ccdn-user-security-bundle

CCDN User Security Bundle

58100.7k](/packages/codeconsortium-ccdn-user-security-bundle)[anyx/login-gate-bundle

Checking brute force attacks on site

59342.3k](/packages/anyx-login-gate-bundle)

PHPackages © 2026

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