Download the PHP package detain/rate-limit without Composer
On this page you can find all versions of the php package detain/rate-limit. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download detain/rate-limit
More information about detain/rate-limit
Files in detain/rate-limit
Download detain/rate-limit
More information about detain/rate-limit
Files in detain/rate-limit
Vendor detain
Package rate-limit
Short Description PHP rate limiting library with Token Bucket and Leaky Bucket Algorithms, based on palepurple/rate-limit, grandson to touhonoob/rate-limit, and jeroenvisser101/LeakyBucket
License MIT
Package rate-limit
Short Description PHP rate limiting library with Token Bucket and Leaky Bucket Algorithms, based on palepurple/rate-limit, grandson to touhonoob/rate-limit, and jeroenvisser101/LeakyBucket
License MIT
Please rate this library. Is it a good library?
Informations about the package rate-limit
rate-limit
PHP Rate Limiting library with both Token Bucket and Leaky Bucket Algorithms, minimal external dependencies, and many storage backends.
Algorithms
-
[x] Token Bucket Algorithm Token Bucket is an algorithm which works as follows:
- There is a bucket.
- A token is added to the bucket every 1/r seconds.
- The bucket can hold at the most b tokens. If a token arrives when the bucket is full, it is discarded.
- When a packet (network layer PDU) of n bytes arrives,
- If at least n tokens are in the bucket, n tokens are removed from the bucket, and the packet is sent to the network.
- if fewer than n tokens are available, no tokens are removed from the bucket, and the packet is considered to be non-conformant.
- [x] Leaky Bucket Algorithm Leaky Bucket is an algorithm which works as follows:
- There is a bucket.
- The bucket has a defined leak and defined capacity.
- The bucket leaks at a constant rate.
- Overflows when full, will not add other drops to the bucket.
Storage Adapters
The RateLimiter needs to know where to get/set data.
Depending on which adapter you install, you may need to install additional libraries (predis/predis or tedivm/stash) or PHP extensions (e.g. Redis, Memcache, APCu)
- APCu
- Redis or Predis
- Stash (This supports many drivers - see http://www.stashphp.com/Drivers.html )
- Memcached
Installing via Composer
`
Usage
Token Bucket
``
Leaky Bucket
Basic usage
Other functionality
You can also do great stuff with it through the methods that LeakyBucket provides.
References
Continuation or Expansion of these Projects
- this code is forked from DavidGoodwin/RateLimit
- which was built on touhonoob/RateLimit
- and then i merged it with jeroenvisser101/LeakyBucket
Knowledge
PSR-7 Middleware Handlers to Base the Future PSR7 Support Off Of
- nikolaposa/rate-limit 🚔 Standalone component that facilitates rate-limiting functionality. Also provides a middleware designed for API and/or other application endpoints.
- robwittman/leaky-bucket-rate-limiter PSR-7 Leaky Bucket Rate Limiter - This middleware enables API Rate-Limiting based on a Leaky Bucket algorithm.
All versions of rate-limit with dependencies
PHP Build Version
Package Version
Requires
php Version
>=5.6
The package detain/rate-limit contains the following files
Loading the files please wait ....