php-ratelimiter
php-ratelimiter copied to clipboard
A small class that uses Memcache to allow only a certain number of requests per a certain amount of minutes.
Any chance on updating it so it will work with Memcached? Memcache is no longer used or suppoprted.
Hallo Alexander, For our own usage I adjusted this to work with memcached instead of memcache. If you're open to this you can merge. If you would rather keep it...
With this branch we can do this: ``` php $memcache = new Memcache; $memcache->connect('127.0.0.1',11211); $rateLimiter = new RateLimiter($memcache, $_SERVER["REMOTE_ADDR"]); try { // 10 requests / minute $rateLimiter->limitRequestsInMinutes(10, 1); } catch...
This PR will add composer support & PSR-4 autoloading. If merged, please submit the repo to [Packagist](https://packagist.org/packages/submit)