You are viewing an older version of the documentation. For the latest, please visit master documentation.

Limit

Properties

public

$key mixed|string

The rate limit signature key.

Default: null
public

$maxAttempts int

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

Default: null
public

$decayMinutes int

The number of minutes until the rate limit is reset.

Default: null
public

$responseCallback callable

The response generator callback.

Default: null

Methods

public

__construct ( $key , int $maxAttempts , int $decayMinutes ) : void

Create a new limit instance.

Parameters

  • $key mixed|string
  • $maxAttempts int
  • $decayMinutes int
public static

perMinute ( $maxAttempts ) : static

Create a new rate limit.

Parameters

  • $maxAttempts int
public static

perMinutes ( $decayMinutes , $maxAttempts ) : static

Create a new rate limit using minutes as decay time.

Parameters

  • $decayMinutes int
  • $maxAttempts int
public static

perHour ( $maxAttempts , $decayHours ) : static

Create a new rate limit using hours as decay time.

Parameters

  • $maxAttempts int
  • $decayHours int
public static

perDay ( $maxAttempts , $decayDays ) : static

Create a new rate limit using days as decay time.

Parameters

  • $maxAttempts int
  • $decayDays int
public static

none ( ) : static

Create a new unlimited rate limit.

public

by ( $key ) : $this

Set the key of the rate limit.

Parameters

  • $key string
public

response ( callable $callback ) : $this

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

Parameters

  • $callback callable