PHP code example of fyre / ratelimiter

1. Go to this page and download the library: Download fyre/ratelimiter 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/ */

    

fyre / ratelimiter example snippets


use Fyre\Security\RateLimiter;

$limiter = new RateLimiter($container, $cacheManager, $options);

$limiter = $container->use(RateLimiter::class, ['options' => $options]);

$response = $limiter->addHeaders($response);

$result = $limiter->checkLimit($request);

$response = $limiter->errorResponse($request);

use Fyre\Security\Middleware\RateLimiterMiddleware;

$middleware = new RateLimiterMiddleware($container, $options);

$middleware = $container->build(RateLimiterMiddleware::class, ['options' => $options]);

$response = $middleware->handle($request, $next);