goksagun/rate-limit-bundle

Rate limit bundle

Installs: 705

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:symfony-bundle

v0.2.1 2019-05-10 09:29 UTC

This package is auto-updated.

Last update: 2024-11-10 22:04:42 UTC


README

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require goksagun/rate-limit-bundle

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:

// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            // ...
            new Goksagun\RateLimitBundle\RateLimitBundle(),
        ];

        // ...
    }

    // ...
}

Step 3: Add the Bundle config file (for symfony version 2, 3)

Then, add the bundle configuration yml file rate_limit.yml into app/config directory:

rate_limit:
    enabled: true
    paths:
         - { path: /limit, limit: 100, period: 60 }
         - { path: /limit-dynamic-increment, limit: 1000, period: 60, increment: 10 }

Import new config file to config.yml into app/config directory:

imports:
    ...
    - { resource: rate_limit.yml }