PHP code example of beyondcode / laravel-fixed-window-limiter

1. Go to this page and download the library: Download beyondcode/laravel-fixed-window-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/ */

    

beyondcode / laravel-fixed-window-limiter example snippets


$limiter->attempt('user_1');

$count = $limiter->getUsage('user_1');

$count = $limiter->getRealUsage('user_1');

$limiter->reset('user_1');

$limiter->reset('user_1', [
    'key' => 'value'
]);

$value = $limiter->getAdditionalData('user_1', 'key');
 php
$limiter = FixedWindowLimiter::create(CarbonInterval::second(2), 2);