dcabrejas/magento-rate-limit
最新稳定版本:1.0.0
Composer 安装命令:
composer require dcabrejas/magento-rate-limit
包简介
Rate Limiting Library With Token Bucket Algorithm with Magento Adapter
README 文档
README
Magento 2 adapter for the touhonoob/RateLimit Library
Installation
composer require dcabrejas/magento-rate-limit
Usage
//Inject the adapter via dependency injection public function __construct(\Dcabrejas\RateLimit\Adapter\Magento $magentoAdapter) { $this->magentoAdapter = $magentoAdapter; } $rateLimit = new \Touhonoob\RateLimit\RateLimit("myratelimit", 100, 3600, $this->magentoAdapter); // 100 Requests / Hour $id = $_SERVER['REMOTE_ADDR']; // Use client IP as identity if ($rateLimit->check($id) > 0) { echo "passed"; } else { echo "rate limit exceeded"; }
统计信息
- 总下载量: 7.19k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-07-05