PHP Classes

Reactive Asynchronous Rate Limiter PHP: Limit the handling of requests to a given rate

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2025-02-20 (Yesterday) RSS 2.0 feedNot yet rated by the usersTotal: Not yet counted Not yet ranked
Version License PHP version Categories
reactive-asynchronou 1.0GNU General Publi...7Performance and optimization, PHP 7
Description 

Author

This package can limit the handling of requests to a given rate.

It provides a class that can handle requests and count the number of requests in a given amount of time.

The class can handle POSIX USR1 signals to simulate the handling of requests.

Picture of Nitesh Apte
  Performance   Level  
Name: Nitesh Apte <contact>
Classes: 20 packages by
Country: India India
Innovation award
Innovation award
Nominee: 5x

Winner: 1x

Example

<?php
include 'ReactiveRateLimiter.php';

// Allow 5 requests every 5 seconds
$rateLimiter = new ReactiveRateLimiter(5, 5.0);

// Simulate periodic requests
while (true) {
   
$rateLimiter->sendRequest();
   
usleep(200000); // 0.2 seconds between requests
}
?>


  Files folder image Files (4)  
File Role Description
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file LICENSE Lic. License text
Plain text file ReactiveRateLimiter.php Class Class source
Accessible without login Plain text file README.md Doc. Read me script

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads  
 100%
Total:0
This week:0