Switon's request throttling layer for #[RateLimit] rules, burst-aware windows, and HTTP 429 rejections.
- Declarative limits:
#[RateLimit]can be applied to controllers or actions. - Layered rules: class defaults set the baseline, and method rules can override them.
- Programmatic checks: the same limit syntax can be used directly.
- Burst handling: the first window can allow burst tolerance.
- Rejection visibility:
ThrottlingandThrottledsurface the applied window and outcome.
composer require switon/throttleuse Switon\Throttle\Attribute\RateLimit;
#[RateLimit('10/m')]
final class ApiController
{
public function searchAction(): array
{
return [];
}
}Docs: https://docs.switon.dev/latest/throttle
MIT.