check()
check(string $key, integer $capacity, integer $seconds, integer $cost) : boolean
Restricts the number of requests made by a single key within a set number of seconds.
Example:
if (! $throttler->checkIPAddress($request->ipAddress(), 60, MINUTE)) { die('You submitted over 60 requests within a minute.'); }
Parameters
string | $key | The name to use as the "bucket" name. |
integer | $capacity | The number of requests the "bucket" can hold |
integer | $seconds | The time it takes the "bucket" to completely refill |
integer | $cost | The number of tokens this action uses. |