mitirrli/limit

限制接口请求次数

1.0.7 2019-09-04 04:34 UTC

This package is auto-updated.

Last update: 2024-11-06 21:21:00 UTC


README

🌈 基于redis的接口限制组件

Build Status StyleCI build status Total Downloads Latest Stable Version Latest Unstable Version License

环境需求

  • PHP >= 5.6

安装

$ composer require "mitirrli/limit"

使用

$config = [
    'second' => 60,//多少秒
    'num' => 50,//接口请求次数
    'redis' => [//redis配置

    ],
];
        
$limit = new Limit($config);//限制接口请求次数
if (!$limit->run()) return['1005', '当前接口请求次数已达上限,请稍后重试'];