midnite81/guardian
Composer 安装命令:
composer require midnite81/guardian
包简介
Guardian is a PHP package that provides a way to wrap HTTP requests so they don't exceed Rate Limiting rules and controls Error Handling
README 文档
README
Guardian is a powerful and flexible rate limiting and error handling library for PHP applications. It provides a robust system for managing API rate limits, preventing abuse, and handling errors gracefully. Guardian can be used in any PHP project and has built-in support for Laravel applications. Full documentation: guardian.midnite.uk
Requirements
- PHP 8.2 or higher
Key Features
- Flexible rate limiting rules
- Configurable error handling
- Multiple cache drivers (File, Redis, Laravel)
- Ability to add custom drivers
- Easy integration with Laravel
- Customizable for any PHP project
Installation
Install Guardian via Composer:
composer require midnite81/guardian
Quick Start
use Midnite81\Guardian\Factories\GuardianFactory; use Midnite81\Guardian\Store\FileStore; use Midnite81\Guardian\Rules\RateLimitRule; $guardian = GuardianFactory::create( 'my-api', new FileStore('/path/to/cache'), [RateLimitRule::allow(100)->perMinute()] ); $result = $guardian->send(function() { // Your API logic here });
Documentation
For detailed usage instructions, API reference, and advanced configuration options, please refer to the official Guardian documentation:
Future plans for Guardian
As of October 2024, Guardian has just been released and there is no roadmap as such for it as yet. Its use in the wild might bring in required features.
Some initial thoughts:
- More integration for Laravel, but introducing a config file to make getting instances more easily
- Adding in a way to work with PSR-7, PSR-18, PSR-17, and PSR-15
Contributing
Contributions are welcome! Please see our Contributing Guide for more details.
License
Guardian is open-sourced software licensed under the MIT license.
midnite81/guardian 适用场景与选型建议
midnite81/guardian 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 10 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 midnite81/guardian 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 midnite81/guardian 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-10-06