Skip to content

bpolaszek/funnel-http-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Handle Rate Limits within Symfony Http Client.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages