定制 midnite81/guardian 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

midnite81/guardian

最新稳定版本:v1.0.3

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:

https://guardian.midnite.uk

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.

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固