ApiRateLimitMiddleware
extends Middleware
in package
API rate limiting middleware.
Enforces per-key request rate limits using a sliding window counter. Returns standard rate limit headers (X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, Retry-After) and responds with 429 when exceeded.
Tags
Table of Contents
Methods
- handle() : bool
- Check and enforce rate limits for the authenticated API key.
Methods
handle()
Check and enforce rate limits for the authenticated API key.
public
handle([array<string|int, mixed> $params = [] ]) : bool
Must run after ApiAuthMiddleware so ApiContext is populated.
Parameters
- $params : array<string|int, mixed> = []
-
Route parameters
Return values
bool —True if within limits, false if rate limited