Download the PHP package alphavel/rate-limit without Composer
On this page you can find all versions of the php package alphavel/rate-limit. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download alphavel/rate-limit
More information about alphavel/rate-limit
Files in alphavel/rate-limit
Download alphavel/rate-limit
More information about alphavel/rate-limit
Files in alphavel/rate-limit
Vendor alphavel
Package rate-limit
Short Description High-performance rate limiting for Alphavel using Swoole Table
License MIT
Package rate-limit
Short Description High-performance rate limiting for Alphavel using Swoole Table
License MIT
Please rate this library. Is it a good library?
Informations about the package rate-limit
Alphavel Rate Limit
High-performance rate limiting package for Alphavel Framework using Swoole Table.
Features
- ⚡ 0.001ms latency (1000x faster than Redis)
- 🚀 Zero dependencies (Swoole built-in)
- 🔒 Thread-safe (atomic operations)
- 💾 Shared memory between workers
- 🎯 Multiple levels (IP, User, Endpoint, Global)
- 🛡️ DDoS protection (global rate limiting)
- 📊 CLI tools (stats, list, reset, block)
Performance
Installation
Configuration
Publish configuration:
Configure .env:
Usage
Basic Usage
Multiple Levels (Defense in Depth)
Available Levels
ip- Rate limit by IP addressuser- Rate limit by authenticated user IDapi_key- Rate limit by API key (X-API-Key header)endpoint- Rate limit by IP + endpoint pathsession- Rate limit by session IDglobal- Global rate limit (DDoS protection)
CLI Commands
Show Statistics
List Active Limits
Reset Rate Limit
Block IP/User
Whitelist
Add trusted IPs to whitelist (never rate limited):
Global Rate Limit (DDoS Protection)
Enable global rate limiting to protect against DDoS:
This is applied before individual rate limits.
Response Headers
Rate limit information is included in response headers:
When rate limit is exceeded:
Memory Usage
Swoole Table memory calculation:
- 16 bytes per entry
- 100k entries = 1.6 MB
- 1M entries = 16 MB
Configure based on your needs:
Bootstrap (Important!)
Initialize Swoole Table before $server->start():
Testing
Benchmarking
Requirements
- PHP >= 8.1
- Swoole Extension >= 5.0
- Alphavel Framework >= 1.0
License
MIT License - see LICENSE file for details.
All versions of rate-limit with dependencies
PHP Build Version
Package Version
The package alphavel/rate-limit contains the following files
Loading the files please wait ...