ghua/zim32-request-limit-bundle

There is no license information available for the latest version (dev-master) of this package.

With this bundle you can easy limit requests to your application

Installs: 141

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 4

Type:symfony-bundle

dev-master 2012-11-19 10:16 UTC

This package is not auto-updated.

Last update: 2024-04-27 12:16:12 UTC


README

Overview

With this bundle you can easy limit requests to your application

Installation

  1. Add Zim32RequestLimitBundle to your deps file

    [Zim32RequestLimitBundle] git=git://github.com/zim32/Symfony2-RequestLimitBundle.git target=/bundles/Zim32/RequestLimitBundle Make /bin/vendors install

  2. Add Zim32RequestLimitBundle to your AppKernel

    $bundles = array( ................. new Zim32\RequestLimitBundle\Zim32RequestLimitBundle(), );

  3. Add Zim32 namespace into your /app/autoload.php

    $loader->registerNamespaces(array( ................ 'Zim32' => DIR.'/../vendor/bundles', ));

  4. Configure your application. For example

    zim32_request_limit: rules: rule: path: /profile/ limit: 1 per: 60 ip: 192.168.1.2 some_foo_name: path: / limit: 10 per: 1

First rule will limit requests for 1 request per 60 seconds from ip 192.168.1.2 for URL starting with /profile/

Reference

  1. path (required) - path to apply rule
  2. limit (required) - number of requests. For immediate deny use '0' for limit
  3. per (required) - seconds
  4. ip (optional) - limit by remote ip

You can use several rules at the same time