class Illuminate / Routing / Middleware / ThrottleRequests
You are viewing an older version of the documentation. For the latest, please visit master documentation.

ThrottleRequests

Uses

Properties

protected

$limiter RateLimiter

The rate limiter instance.

Default: null

Methods

public

__construct ( RateLimiter $limiter ) : void

Create a new request throttler.

Parameters

public

handle ( $request , Closure $next , $maxAttempts , $decayMinutes , $prefix ) : Symfony\...\Response

Handle an incoming request.

Parameters

  • $request Request
  • $next Closure
  • $maxAttempts int|string
  • $decayMinutes float|int
  • $prefix string
protected

handleRequestUsingNamedLimiter ( $request , Closure $next , $limiterName , Closure $limiter ) : Symfony\...\Response

Handle an incoming request.

Parameters

protected

handleRequest ( $request , Closure $next , array $limits ) : Symfony\...\Response

Handle an incoming request.

Parameters

protected

resolveMaxAttempts ( $request , $maxAttempts ) : int

Resolve the number of attempts if the user is authenticated or not.

Parameters

  • $request Request
  • $maxAttempts int|string
protected

resolveRequestSignature ( $request ) : string

Resolve request signature.

Parameters

protected

buildException ( $request , $key , $maxAttempts , $responseCallback ) : ThrottleRequestsException

Create a 'too many attempts' exception.

Parameters

  • $request Request
  • $key string
  • $maxAttempts int
  • $responseCallback callable|null
protected

getTimeUntilNextRetry ( $key ) : int

Get the number of seconds until the next retry.

Parameters

  • $key string
protected

addHeaders ( Symfony\...\Response $response , $maxAttempts , $remainingAttempts , $retryAfter ) : Symfony\...\Response

Add the limit header information to the given response.

Parameters

  • $response Symfony\...\Response
  • $maxAttempts int
  • $remainingAttempts int
  • $retryAfter int|null
protected

getHeaders ( $maxAttempts , $remainingAttempts , $retryAfter , Symfony\...\Response $response ) : array

Get the limit headers information.

Parameters

  • $maxAttempts int
  • $remainingAttempts int
  • $retryAfter int|null
  • $response Symfony\...\Response|null
protected

calculateRemainingAttempts ( $key , $maxAttempts , $retryAfter ) : int

Calculate the number of remaining attempts.

Parameters

  • $key string
  • $maxAttempts int
  • $retryAfter int|null