A decorator for symfony/http-client to throttle requests subject to rate-limits.
composer require bentools/funnel-http-client:1.0.x-dev
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./vendor/bin/phpunit
MIT.