PHP code example of davidfricker / floodgates
1. Go to this page and download the library: Download davidfricker/floodgates 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/ */
davidfricker / floodgates example snippets
$UID = md5('127.0.0.1');
$bucket_capacity = 5;
$leak_rate = 60;
$Floodgates = new Floodgates($UID, $bucket_capacity, $leak_rate);
if (!$Floodgates->addDrop()) {
die('Rate limit exceeded');
}
// perform the the task that would otherwise be rate limited here
$drops = 3;
if (!$Floodgates->addDrop($drops)) {
die('Rate limit exceeded');
}
// perform the the task that would otherwise be rate limited here