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) Обработать входящий запрос. | |
| 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)
Обработать входящий запрос.
protected int resolveMaxAttempts(Запрос $request, int|string $maxAttempts)
Определить количество попыток, если пользователь аутентифицирован или нет.
protected string resolveRequestSignature(Запрос $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/5.8/Illuminate/Routing/Middleware/ThrottleRequests.html