ThrottleRequests
class ThrottleRequests (View source)
Properties
protected RateLimiter | $limiter | The rate limiter instance. |
Methods
void | __construct(RateLimiter $limiter) Create a new request throttler. | |
mixed | handle(Request $request, Closure $next, int $maxAttempts = 60, float|int $decayMinutes = 1) Handle an incoming request. | |
string | resolveRequestSignature(Request $request) Resolve request signature. | |
Response | buildResponse(string $key, int $maxAttempts) Create a 'too many attempts' response. | |
Response | addHeaders(Response $response, int $maxAttempts, int $remainingAttempts, int|null $retryAfter = null) Add the limit header information to the given response. | |
int | calculateRemainingAttempts(string $key, int $maxAttempts, int|null $retryAfter = null) Calculate the number of remaining attempts. |
Details
void __construct(RateLimiter $limiter)
Create a new request throttler.
mixed handle(Request $request, Closure $next, int $maxAttempts = 60, float|int $decayMinutes = 1)
Handle an incoming request.
protected string resolveRequestSignature(Request $request)
Resolve request signature.
protected Response buildResponse(string $key, int $maxAttempts)
Create a 'too many attempts' response.
protected Response addHeaders(Response $response, int $maxAttempts, int $remainingAttempts, int|null $retryAfter = null)
Add the limit header information to the given response.
protected int calculateRemainingAttempts(string $key, int $maxAttempts, int|null $retryAfter = null)
Calculate the number of remaining attempts.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.3/Illuminate/Routing/Middleware/ThrottleRequests.html