quillphp / limiter
Quill PHP limiter middleware
dev-main
2026-04-06 09:34 UTC
Requires
- php: >=8.3
- quillphp/quill: ^0.0.2
Requires (Dev)
- phpunit/phpunit: ^11.0
This package is auto-updated.
Last update: 2026-04-06 11:59:52 UTC
README
High-performance rate limiting middleware for the Quill PHP Framework. Protects your API from brute-force and DDoS attacks.
Installation
composer require quillphp/limiter
Usage
use Quill\Limiter\Limiter; use Quill\Storage\RedisStorage; $app->use(Limiter::new([ 'storage' => new RedisStorage(['host' => '127.0.0.1']), 'limit' => 100, // 100 requests 'window' => 60, // per 60 seconds ]));
Configuration
| Option | Default | Description |
|---|---|---|
| `limit` | `100` | Maximum number of requests allowed in the window. |
| `window` | `60` | Time window in seconds. |
| `key_generator` | `fn(Request $r) => $r->ip()` | Custom key generator for throttling. |
| `error_code` | `429` | HTTP status code for rate limit exceeded. |
| `error_message` | `'Too Many Requests'` | Error message for rate limit exceeded. |
License
MIT