PHP code example of php-http / throttle-plugin
1. Go to this page and download the library: Download php-http/throttle-plugin library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
php-http / throttle-plugin example snippets
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(),
);