PHPackages                             maba/gentle-force - 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. maba/gentle-force

ActiveLibrary[Caching](/categories/caching)

maba/gentle-force
=================

Library for limiting both brute-force attempts and ordinary requests, using leaky/token bucket algorithm, based on Redis

0.3.1(4y ago)45616.5k↓47.4%12[5 issues](https://github.com/mariusbalcytis/gentle-force/issues)[4 PRs](https://github.com/mariusbalcytis/gentle-force/pulls)2MITPHPPHP ^7.1 | ^8.0

Since May 10Pushed 4y ago2 watchersCompare

[ Source](https://github.com/mariusbalcytis/gentle-force)[ Packagist](https://packagist.org/packages/maba/gentle-force)[ RSS](/packages/maba-gentle-force/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)Dependencies (5)Versions (7)Used By (2)

Gentle-force: brute-force, error and request rate limiting
==========================================================

[](#gentle-force-brute-force-error-and-request-rate-limiting)

This is a library for rate-limiting both brute-force attempts (like invalid credentials) and ordinary requests.

Features
--------

[](#features)

- can be used to limit brute-force attempts;
- can be used for request rate limiting;
- uses leaky / token bucket algorithm. This means that user does not have to wait for next hour or day - additional attempts are possible as time goes by. This also means that requests does not come in big batches when every hour starts;
- handles race-conditions. This is important for brute-force limiting. For example, if 1000 requests are issued at the same time to check same user's password, only configured number of attempts will be possible;
- can have several limits configured for single use-case (for example maximum of 100 requests per minute and 200 per hour);
- does not make assumptions about where and what it's used for - it can be used with user identifiers, API tokens, IP addresses or any other data to group usages.

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

[](#installation)

```
composer require maba/gentle-force

```

Usage
-----

[](#usage)

```
