class Unlimited extends GlobalLimit (View source)

Properties

mixed $key

The rate limit signature key.

from  Limit
int $maxAttempts

The maximum number of attempts allowed within the given number of seconds.

from  Limit
int $decaySeconds

The number of seconds until the rate limit is reset.

from  Limit
callable $responseCallback

The response generator callback.

from  Limit

Methods

void
__construct()

Create a new limit instance.

static Limit
perSecond(int $maxAttempts, int $decaySeconds = 1)

Create a new rate limit.

from  Limit
static Limit
perMinute(int $maxAttempts, int $decayMinutes = 1)

Create a new rate limit.

from  Limit
static Limit
perMinutes(int $decayMinutes, int $maxAttempts)

Create a new rate limit using minutes as decay time.

from  Limit
static Limit
perHour(int $maxAttempts, int $decayHours = 1)

Create a new rate limit using hours as decay time.

from  Limit
static Limit
perDay(int $maxAttempts, int $decayDays = 1)

Create a new rate limit using days as decay time.

from  Limit
static Limit
none()

Create a new unlimited rate limit.

from  Limit
$this
by(mixed $key)

Set the key of the rate limit.

from  Limit
$this
response(callable $callback)

Set the callback that should generate the response when the limit is exceeded.

from  Limit
string
fallbackKey()

Get a potential fallback key for the limit.

from  Limit

Details

void __construct()

Create a new limit instance.

Return Value

void

static Limit perSecond(int $maxAttempts, int $decaySeconds = 1)

Create a new rate limit.

Parameters

int $maxAttempts
int $decaySeconds

Return Value

Limit

static Limit perMinute(int $maxAttempts, int $decayMinutes = 1)

Create a new rate limit.

Parameters

int $maxAttempts
int $decayMinutes

Return Value

Limit

static Limit perMinutes(int $decayMinutes, int $maxAttempts)

Create a new rate limit using minutes as decay time.

Parameters

int $decayMinutes
int $maxAttempts

Return Value

Limit

static Limit perHour(int $maxAttempts, int $decayHours = 1)

Create a new rate limit using hours as decay time.

Parameters

int $maxAttempts
int $decayHours

Return Value

Limit

static Limit perDay(int $maxAttempts, int $decayDays = 1)

Create a new rate limit using days as decay time.

Parameters

int $maxAttempts
int $decayDays

Return Value

Limit

static Limit none()

Create a new unlimited rate limit.

Return Value

Limit

$this by(mixed $key)

Set the key of the rate limit.

Parameters

mixed $key

Return Value

$this

$this response(callable $callback)

Set the callback that should generate the response when the limit is exceeded.

Parameters

callable $callback

Return Value

$this

string fallbackKey()

Get a potential fallback key for the limit.

Return Value

string