Registry / utility / symfony-rate-limiter

symfony-rate-limiter

JSON →
library8.1.0phppackagistunverified

Provides a Token Bucket implementation to rate limit input and output in your application

composer require symfony/rate-limiter
INSTALL
IMPORT
SIG · SYMFONY-RATE-LIMIT
S
symfony-rate-limiter
utilityphpv8.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RateLimiterFactory
use Symfony\Component\RateLimiter\RateLimiterFactory;

Create a rate limiter using the Token Bucket algorithm

use Symfony\Component\RateLimiter\RateLimiterFactory; use Symfony\Component\RateLimiter\Storage\InMemoryStorage; $factory = new RateLimiterFactory(['id' => 'api', 'policy' => 'token_bucket', 'limit' => 100, 'rate' => ['interval' => '1 minute']], new InMemoryStorage()); $limiter = $factory->create(); $limiter->consume()->isAccepted();
Debug
Known issues
breakingRequires PHP 8.1 or higher
fix
Upgrade PHP to 8.1+
affects: <8.1
Upgrade
Version history
8.1.0latest on Packagist
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
symfony-rate-limiter — pip install symfony-rate-limiter · libregistry