https://github.com/coolephp/rate-limiter
Provides a Token Bucket implementation to rate limit input and output in your Coole application. - 提供令牌桶实现来限制 Coole 应用程序中的输入和输出。
https://github.com/coolephp/rate-limiter
limiter rate rate-limiter
Last synced: 1 day ago
JSON representation
Provides a Token Bucket implementation to rate limit input and output in your Coole application. - 提供令牌桶实现来限制 Coole 应用程序中的输入和输出。
- Host: GitHub
- URL: https://github.com/coolephp/rate-limiter
- Owner: coolephp
- License: mit
- Created: 2021-06-02T05:22:29.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-06-05T08:35:27.000Z (almost 5 years ago)
- Last Synced: 2025-09-15T17:51:35.927Z (7 months ago)
- Topics: limiter, rate, rate-limiter
- Language: PHP
- Homepage:
- Size: 539 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README-CN.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
# rate-limiter
[简体中文](README-CN.md) | [ENGLISH](README.md)
> Provides a Token Bucket implementation to rate limit input and output in your Coole application. - 提供令牌桶实现来限制 Coole 应用程序中的输入和输出。
[](https://github.com/coolephp/rate-limiter/actions)
[](https://github.com/coolephp/rate-limiter/actions)
[](https://codecov.io/gh/coolephp/rate-limiter)
[](//packagist.org/packages/coolephp/rate-limiter)
[](//packagist.org/packages/coolephp/rate-limiter)
[](//packagist.org/packages/coolephp/rate-limiter)
## 环境要求
* PHP >= 7.2
## 安装
``` bash
$ composer require coolephp/rate-limiter --prefer-dist -vvv
```
## 使用
1. 复制 `rate-limiter/config/rate-limiter.php` 为 `coole-skeleton/config/rate-limiter.php`.
2. 配置 `\Coole\RateLimiter\RateLimiter::class` 中间件.
``` php
env('APP_NAME', 'Coole'),
/*
* 全局中间件
*/
'middleware' => [
...
\Coole\RateLimiter\RateLimiter::class
...
],
];
```


## 测试
``` bash
$ composer test
```
## 变更日志
请参阅 [CHANGELOG](CHANGELOG.md) 获取最近有关更改的更多信息。
## 贡献指南
请参阅 [CONTRIBUTING](.github/CONTRIBUTING.md) 有关详细信息。
## 安全漏洞
请查看[我们的安全政策](../../security/policy)了解如何报告安全漏洞。
## 贡献者
* [guanguans](https://github.com/guanguans)
* [所有贡献者](../../contributors)
## 协议
MIT 许可证(MIT)。有关更多信息,请参见[协议文件](LICENSE)。