| Fully Qualified Name: | CodeIgniter\Throttle\ThrottlerInterface |
Expected behavior of a Throttler
| Name | Description | Defined By |
|---|---|---|
| check() | Restricts the number of requests made by a single key within a set number of seconds. | ThrottlerInterface |
| getTokenTime() | Returns the number of seconds until the next available token will be released for usage. | ThrottlerInterface |
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.');
}
| Parameter Name | Type | Description |
|---|---|---|
| $key | string | The |
| $capacity | int | The |
| $seconds | int | The |
| $cost | int | The |
Returns: bool
Returns the number of seconds until the next available token will be released for usage.
Returns: int