lamoda / tactician-rate-limit
This package is abandoned and no longer maintained.
No replacement package was suggested.
Tactician command bus middleware for rate limiting command execution
0.1.1
2019-03-01 17:19 UTC
Requires
- php: ^7.1
- league/tactician: ^1.0
- psr/log: ^1.0
Requires (Dev)
- davedevelopment/stiphle: ^0.9.2
- phpunit/phpunit: ^7.2
Suggests
- davedevelopment/stiphle: Allow using stiphle as a rate limiter implementation
This package is auto-updated.
Last update: 2023-05-29 01:14:59 UTC
README
Installation
Usage is as simple as
composer require lamoda/tactician-rate-limit
After that you need to choose library that is providing rate limiting capabilities. For now there out of the box support for the following libraries:
To use this library do the following:
- Require
stiphle
via composer:composer require davedevelopment/stiphle
- Configure middleware:
$rateLimitProvider = new MatchingCommandClassRateLimitProvider( RateLimitedCommand::class, 3, // max commands to execute per interval 1000 // interval in milliseconds ); $rateLimiter = new StiphleRateLimiterAdapter(new LeakyBucket()); $rateLimitMiddleware = new RateLimitMiddleware( $rateLimitProvider, $rateLimiter ); // Create command bus with this middleware: $commandBus = new CommandBus([ $rateLimitMiddleware, // other middlewares ]);
If you are using Symfony: use lamoda/tactician-rate-limit-bundle