Skip to content

PHP HTTP rate limit library helps catch extremely unnecessary HTTP requests, allows you to manage a certain number of HTTP requests in a certain time frame

Notifications You must be signed in to change notification settings

diloabininyeri/throttle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP rate limit library with redis

install with composer

composer require zeus/throttle

Sets http request limitations, such as only 100 accesses in 10 minutes Powerful redis handles HTTP requests, you can easily integrate it into all api or projects

use Throttle\Throttle;
use Throttle\Time;



$throttle = new Throttle(
    new Time(60, 25)
);

$throttle->commit();


if ($throttle->isHasAccessLimit()) {
    print 'request can go next';
} else {
    print 'max request amount';
}


if you want to configure a redis client

use Throttle\Throttle;
use Throttle\Time;
use Throttle\Redis;


Redis::setRedisClient(new \Predis\Client($params));

$throttle = new Throttle(
    new Time(60, 25)
);

$throttle->commit();


if ($throttle->isHasAccessLimit()) {
    print 'request can go next';
} else {
    print 'max request amount';
}

Get detail

$throttle->getDetail()->toArray();

About

PHP HTTP rate limit library helps catch extremely unnecessary HTTP requests, allows you to manage a certain number of HTTP requests in a certain time frame

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages