Skip to content

switon-php/throttle

Repository files navigation

Switon Throttle Package

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.

About

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

Topics

Resources

License

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages