ThrottleRequests
class ThrottleRequests (View source)
Свойства
| InteractsWithTime |
Свойства
| protected RateLimiter | $limiter | Экземпляр ограничителя скорости. |
Методы
| int | secondsUntil(DateTimeInterface|DateInterval|int $delay)
Получить количество секунд до заданной даты и времени. | из InteractsWithTime |
| int | availableAt(DateTimeInterface|DateInterval|int $delay = 0)
Получить отметку времени "доступно в" в формате UNIX. | из InteractsWithTime |
| DateTimeInterface|int | parseDateInterval(DateTimeInterface|DateInterval|int $delay)
Если заданное значение — интервал, преобразовать его в экземпляр DateTime. | из InteractsWithTime |
| int | currentTime()
Получить текущее системное время в формате UNIX. | из InteractsWithTime |
| void | __construct(RateLimiter $limiter)
Создать новый ограничитель запросов. | |
| Response | handle(Request $request, Closure $next, int|string $maxAttempts = 60, float|int $decayMinutes = 1, string $prefix = '')
Обработать входящий запрос. | |
| int | resolveMaxAttempts(Request $request, int|string $maxAttempts)
Разрешить количество попыток, если пользователь авторизован или нет. | |
| string | resolveRequestSignature(Request $request)
Разрешить подпись запроса. | |
| ThrottleRequestsException | buildException(string $key, int $maxAttempts)
Создать исключение "слишком много попыток". | |
| int | getTimeUntilNextRetry(string $key)
Получить количество секунд до следующей попытки. | |
| Response | addHeaders(Response $response, int $maxAttempts, int $remainingAttempts, int|null $retryAfter = null)
Добавить информацию о лимите в заголовки данного ответа. | |
| array | getHeaders(int $maxAttempts, int $remainingAttempts, int|null $retryAfter = null)
Получить информацию о заголовках лимита. | |
| int | calculateRemainingAttempts(string $key, int $maxAttempts, int|null $retryAfter = null)
Рассчитать количество оставшихся попыток. |
Подробное описание
protected int secondsUntil(DateTimeInterface|DateInterval|int $delay)
Получить количество секунд до заданной даты и времени.
protected int availableAt(DateTimeInterface|DateInterval|int $delay = 0)
Получить отметку времени "доступно в" в формате UNIX.
protected DateTimeInterface|int parseDateInterval(DateTimeInterface|DateInterval|int $delay)
Если заданное значение — интервал, преобразовать его в экземпляр DateTime.
protected int currentTime()
Получить текущее системное время в формате UNIX.
void __construct(RateLimiter $limiter)
Создать новый ограничитель запросов.
Response handle(Request $request, Closure $next, int|string $maxAttempts = 60, float|int $decayMinutes = 1, string $prefix = '')
Обработать входящий запрос.
protected int resolveMaxAttempts(Request $request, int|string $maxAttempts)
Определите количество попыток, если пользователь аутентифицирован или нет.
protected string resolveRequestSignature(Request $request)
Определите подпись запроса.
protected ThrottleRequestsException buildException(string $key, int $maxAttempts)
Создайте исключение «слишком много попыток».
protected int getTimeUntilNextRetry(string $key)
Получить количество секунд до следующей попытки.
protected Response addHeaders(Response $response, int $maxAttempts, int $remainingAttempts, int|null $retryAfter = null)
Добавьте информацию заголовка лимита в предоставленный ответ.
protected array getHeaders(int $maxAttempts, int $remainingAttempts, int|null $retryAfter = null)
Получить информацию заголовков лимита.
protected int calculateRemainingAttempts(string $key, int $maxAttempts, int|null $retryAfter = null)
Вычислить количество оставшихся попыток.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/7.x/Illuminate/Routing/Middleware/ThrottleRequests.html