定制 bentools/funnel-http-client 二次开发

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

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

bentools/funnel-http-client

最新稳定版本:1.1

Composer 安装命令:

composer require bentools/funnel-http-client

包简介

A throttler for symfony/http-client to handle rate limits

README 文档

README

Latest Stable Version License CI Workflow Coverage Status Quality Score Total Downloads

🚦 Funnel Http Client

A decorator for symfony/http-client to throttle requests subject to rate-limits.

Installation

composer require bentools/funnel-http-client:1.0.x-dev

Usage

use BenTools\FunnelHttpClient\FunnelHttpClient;
use Symfony\Component\HttpClient\HttpClient;

$client = FunnelHttpClient::throttle(HttpClient::create(), $maxRequests = 3, $timeWindow = 5);

$client->request('GET', 'http://foo.bar');
$client->request('GET', 'http://foo.bar');
$client->request('GET', 'http://foo.bar');

$client->request('GET', 'http://foo.bar'); // Will wait a little before being actually triggered

Tests

./vendor/bin/phpunit

License

MIT.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-06-25