PHP Classes

File: rate_limiter_config.php

Recommend this page to a friend!
  Classes of Nitesh Apte   Rate Limiter PHP   rate_limiter_config.php   Download  
File: rate_limiter_config.php
Role: Configuration script
Content type: text/plain
Description: Configuration script
Class: Rate Limiter PHP
Delay a request response to limit the access rate
Author: By
Last change:
Date: Yesterday
Size: 332 bytes
 

Contents

Class file image Download
<?php
require_once 'RateLimiter.php';

// Create a RateLimiter instance with custom parameters
$rateLimiter = new RateLimiter(
   
limitForPeriod: 2, // Max 2 requests
   
limitRefreshPeriod: 1.0, // Reset limit every 1 second
   
timeoutDuration: 0.1 // Timeout after 500 milliseconds
);

return
$rateLimiter;
?>