Interface ThrottlerInterface

Summary

Fully Qualified Name: CodeIgniter\Throttle\ThrottlerInterface

Description

Expected behavior of a Throttler

Methods

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

Method Details

check()

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

getTokenTime()

Returns the number of seconds until the next available token will be released for usage.

Returns: int

Top