PHP code example of macroman / rate-limiter
1. Go to this page and download the library: Download macroman/rate-limiter 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/ */
macroman / rate-limiter example snippets
// example.php
use RateLimiter\Limiter;
// Limit to 6 iterations per second
$limiter = new Limiter(6, 1);
for ($i = 0; $i < 50; $i++) {
$limiter->await();
// Make your rate limited call here
echo "Iteration $i" . PHP_EOL;
}