class ThrottleRequestsWithRedis extends ThrottleRequests (View source)
| InteractsWithTime |
| protected RateLimiter | $limiter | The rate limiter instance. | from ThrottleRequests |
| static protected bool | $shouldHashKeys | Indicates if the rate limiter keys should be hashed. | from ThrottleRequests |
| protected Factory | $redis | The Redis factory implementation. | |
| array | $decaysAt | The timestamp of the end of the current duration by key. | |
| array | $remaining | The number of remaining slots by key. |
| int | secondsUntil(DateTimeInterface|DateInterval|int $delay)
Get the number of seconds until the given DateTime. | from InteractsWithTime |
| int | availableAt(DateTimeInterface|DateInterval|int $delay = 0)
Get the "available at" UNIX timestamp. | from InteractsWithTime |
| DateTimeInterface|int | parseDateInterval(DateTimeInterface|DateInterval|int $delay)
If the given value is an interval, convert it to a DateTime instance. | from InteractsWithTime |
| int | currentTime()
Get the current system time as a UNIX timestamp. | from InteractsWithTime |
| string | runTimeForHumans(float $startTime, float $endTime = null)
Given a start time, format the total run time for human readability. | from InteractsWithTime |
| void | __construct(RateLimiter $limiter, Factory $redis)
Create a new request throttler. | |
| static string | using(string $name)
Specify the named rate limiter to use for the middleware. | from ThrottleRequests |
| static string | with(int $maxAttempts = 60, int $decayMinutes = 1, string $prefix = '')
Specify the rate limiter configuration for the middleware. | from ThrottleRequests |
| Response | handle(Request $request, Closure $next, int|string $maxAttempts = 60, float|int $decayMinutes = 1, string $prefix = '')
Handle an incoming request. | from ThrottleRequests |
| Response | handleRequestUsingNamedLimiter(Request $request, Closure $next, string $limiterName, Closure $limiter)
Handle an incoming request. | from ThrottleRequests |
| Response | handleRequest(Request $request, Closure $next, array $limits)
Handle an incoming request. | |
| int | resolveMaxAttempts(Request $request, int|string $maxAttempts)
Resolve the number of attempts if the user is authenticated or not. | from ThrottleRequests |
| string | resolveRequestSignature(Request $request)
Resolve request signature. | from ThrottleRequests |
| ThrottleRequestsException|HttpResponseException | buildException(Request $request, string $key, int $maxAttempts, callable|null $responseCallback = null)
Create a 'too many attempts' exception. | from ThrottleRequests |
| int | getTimeUntilNextRetry(string $key)
Get the number of seconds until the lock is released. | |
| Response | addHeaders(Response $response, int $maxAttempts, int $remainingAttempts, int|null $retryAfter = null)
Add the limit header information to the given response. | from ThrottleRequests |
| array | getHeaders(int $maxAttempts, int $remainingAttempts, int|null $retryAfter = null, Response|null $response = null)
Get the limit headers information. | from ThrottleRequests |
| int | calculateRemainingAttempts(string $key, int $maxAttempts, int|null $retryAfter = null)
Calculate the number of remaining attempts. | |
| static void | shouldHashKeys(bool $shouldHashKeys = true)
Specify whether rate limiter keys should be hashed. | from ThrottleRequests |
| mixed | tooManyAttempts(string $key, int $maxAttempts, int $decaySeconds)
Determine if the given key has been "accessed" too many times. | |
| Connection | getRedisConnection()
Get the Redis connection that should be used for throttling. |
Get the number of seconds until the given DateTime.
Get the "available at" UNIX timestamp.
If the given value is an interval, convert it to a DateTime instance.
Get the current system time as a UNIX timestamp.
Given a start time, format the total run time for human readability.
Create a new request throttler.
Specify the named rate limiter to use for the middleware.
Specify the rate limiter configuration for the middleware.
Handle an incoming request.
Handle an incoming request.
Handle an incoming request.
Resolve the number of attempts if the user is authenticated or not.
Resolve request signature.
Create a 'too many attempts' exception.
Get the number of seconds until the lock is released.
Add the limit header information to the given response.
Get the limit headers information.
Calculate the number of remaining attempts.
Specify whether rate limiter keys should be hashed.
Determine if the given key has been "accessed" too many times.
Get the Redis connection that should be used for throttling.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/11.x/Illuminate/Routing/Middleware/ThrottleRequestsWithRedis.html