https://github.com/bpolaszek/funnel-http-client
Handle Rate Limits within Symfony Http Client.
https://github.com/bpolaszek/funnel-http-client
Last synced: 3 months ago
JSON representation
Handle Rate Limits within Symfony Http Client.
- Host: GitHub
- URL: https://github.com/bpolaszek/funnel-http-client
- Owner: bpolaszek
- Created: 2019-06-25T14:03:53.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-10-18T08:15:23.000Z (about 1 year ago)
- Last Synced: 2025-10-06T12:59:09.000Z (3 months ago)
- Language: PHP
- Size: 13.7 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://packagist.org/packages/bentools/funnel-http-client)
[](https://packagist.org/packages/bentools/funnel-http-client)
[](https://github.com/bpolaszek/funnel-http-client/actions/workflows/ci-workflow.yml)
[](https://coveralls.io/github/bpolaszek/funnel-http-client?branch=master)
[](https://scrutinizer-ci.com/g/bpolaszek/funnel-http-client)
[](https://packagist.org/packages/bentools/funnel-http-client)
# :vertical_traffic_light: Funnel Http Client
A decorator for [symfony/http-client](https://symfony.com/doc/current/components/http_client.html) to throttle requests subject to rate-limits.
## Installation
> composer require bentools/funnel-http-client:1.0.x-dev
## Usage
```php
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.