Limit
class Limit (View source)
Properties
Methods
__construct(mixed $key = '', int $maxAttempts = 60, int $decaySeconds = 60)
Create a new limit instance.
static Limit
perMinutes(int $decayMinutes, int $maxAttempts)
Create a new rate limit using minutes as decay time.
static Limit
perHour(int $maxAttempts, int $decayHours = 1)
Create a new rate limit using hours as decay time.
static Limit
perDay(int $maxAttempts, int $decayDays = 1)
Create a new rate limit using days as decay time.
$this
by(mixed $key)
Set the key of the rate limit.
$this
response(callable $callback)
Set the callback that should generate the response when the limit is exceeded.
string
fallbackKey()
Get a potential fallback key for the limit.
Details
__construct(mixed $key = '', int $maxAttempts = 60, int $decaySeconds = 60)
Create a new limit instance.
static Limit
perMinutes(int $decayMinutes, int $maxAttempts)
Create a new rate limit using minutes as decay time.
static Limit
perHour(int $maxAttempts, int $decayHours = 1)
Create a new rate limit using hours as decay time.
static Limit
perDay(int $maxAttempts, int $decayDays = 1)
Create a new rate limit using days as decay time.