switon/throttle

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

Maintainers

Package info

github.com/switon-php/throttle

Documentation

pkg:composer/switon/throttle

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-06-06 13:43 UTC

This package is auto-updated.

Last update: 2026-06-07 05:23:26 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://docs.switon.dev/latest/throttle

License

MIT.