partimate/throttlemate
Composer 安装命令:
composer require partimate/throttlemate
包简介
Adaptive Throttling for Laravel to handle connection bottleneck with Graceful Degradation
README 文档
README
Adaptive Throttling for Laravel with Optional Graceful Degradation
ThrottleMate helps you handle connection bottleneck and API abuse with dynamic adaptive throttling.
Features
- Adaptive Rate Limiting
- Graceful Degradation (Cache + Queue Fallback)
- Compatible from Laravel 5.x to 11.x
- High Performance with Zero Dependency
- Developer Friendly API
- Automatic Cache Recovery
Install
composer require partimate/throttlemate php artisan vendor:publish --tag=throttlemate
Usage
Basic Throttling
use PartiMate\ThrottleMate\AdaptiveThrottler; $result = AdaptiveThrottler::make() ->throttle(fn () => 'Process Request', 'api:request', 100, 60);
Graceful Degradation (Cache Fallback)
$result = AdaptiveThrottler::make('cache', true) ->throttle(fn () => 'Fetch User Data', 'user:fetch', 50, 30);
Graceful Degradation (Queue Fallback)
$result = AdaptiveThrottler::make('queue', true) ->throttle(fn () => 'Send Email', 'email:send', 100, 60);
Throttle Middleware
Route::get('/api/data', [DataController::class, 'index'])->middleware('throttle.mate');
Configurable Rate Limit & TTL
Modify config/throttlemate.php:
return [ 'limit' => 200, // Requests per minute 'ttl' => 120, // Expire time in seconds ];
Benchmark Results ⚡️
| Package | Request Rate | Graceful | CPU Usage | Memory |
|---|---|---|---|---|
| ThrottleMate | 10k/s | ✅ | 🔥 2% | 5MB |
| Laravel | 5k/s | ❌ | 7% | 12MB |
| Redis | 8k/s | ❌ | 5% | 8MB |
Why ThrottleMate?
| Feature | ThrottleMate | Laravel | Redis |
|---|---|---|---|
| Adaptive Rate Limit | ✅ | ❌ | ❌ |
| Graceful Degradation | ✅ | ❌ | ❌ |
| Automatic Recovery | ✅ | ❌ | ❌ |
| Zero Dependency | ✅ | ❌ | ❌ |
| High Performance | 🔥 | ⚡ | ⚡ |
| Easy to Use | ✅ | ✅ | ❌ |
Contributing
Any contributions are welcome! Feel free to submit a pull request or open an issue.
License
ThrottleMate is open-source software licensed under the MIT License.
Contact
Developed with ❤️ by Deden Farhan
partimate/throttlemate 适用场景与选型建议
partimate/throttlemate 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 03 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 partimate/throttlemate 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 partimate/throttlemate 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-06