Search by

switon / throttle

switon

Redis-backed rate limiting for HTTP actions and direct service checks for Switon Framework

v1.0.2 2026-08-22 14:37 UTC

This package is auto-updated.

Last update: 2026-11-24 13:24:32 UTC


README

CI PHP 8.3+

Switon's request throttling layer for #[RateLimit] rules, burst-aware windows, and HTTP 429 rejections.

Highlights

  • 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: Throttling and Throttled surface the applied window and outcome.

Installation

composer require switon/throttle

Quick Start

use Switon\Throttle\Attribute\RateLimit;

#[RateLimit('10/m')]
final class ApiController
{
    public function searchAction(): array
    {
        return [];
    }
}

Docs: https://github.com/switon-php/throttle/blob/main/docs/README.md

License

MIT.