PHP code example of bigchicchicken / api-platform-rate-limiter-bundle

1. Go to this page and download the library: Download bigchicchicken/api-platform-rate-limiter-bundle 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/ */

    

bigchicchicken / api-platform-rate-limiter-bundle example snippets


// config/bundles.php

return [
    // ...
    ApiPlatformRateLimiterBundle\ApiPlatformRateLimiterBundle::class => ['all' => true],
];




// src/Entity/MyClass.php

namespace App\Entity;

use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\GetCollection;

#[ApiResource]
#[GetCollection(extraProperties: [ 'rate_limiter' => 'fixed_window_5_requests_every_10_minutes' ])]
class MyClass
{
    // ...
}