Skip to content

PHP-HTTP plugin for throttling/rate limiting with the symfony/rate-limiter

License

Notifications You must be signed in to change notification settings

php-http/throttle-plugin

Repository files navigation

Throttle Plugin

PHP-HTTP plugin for throttling/rate limiting with the symfony/rate-limiter

Warning: Plugin currently utilizes usleep() and hence is blocking whole process while waiting

Install

Via Composer

composer require php-http/throttle-plugin

Usage

new \Http\Client\Common\Plugin\ThrottlePlugin(
    (new \Symfony\Component\RateLimiter\RateLimiterFactory(
        ['id' => 'foo', 'policy' => 'fixed_window', 'limit' => 2, 'interval' => '3 seconds'],
        new \Symfony\Component\RateLimiter\Storage\InMemoryStorage(),
    ))->create(),
);

Licensing

MIT license. Please see License File for more information.

About

PHP-HTTP plugin for throttling/rate limiting with the symfony/rate-limiter

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages