PHPackages                             instasent/ratelimit-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. instasent/ratelimit-bundle

ActiveSymfony-bundle[HTTP &amp; Networking](/categories/http)

instasent/ratelimit-bundle
==========================

This bundle provides functionality to limit calls to actions based on rate limits

v0.1.0(9y ago)1526[1 issues](https://github.com/instasent/RateLimitBundle/issues)MITPHPCI failing

Since Aug 1Pushed 8y ago3 watchersCompare

[ Source](https://github.com/instasent/RateLimitBundle)[ Packagist](https://packagist.org/packages/instasent/ratelimit-bundle)[ RSS](/packages/instasent-ratelimit-bundle/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

InstasentRateLimitBundle
========================

[](#instasentratelimitbundle)

[![Build Status](https://camo.githubusercontent.com/47ef08c86c0d2dc1838ad33affe0609966e9629619b9a8d10765d82d87594f6b/68747470733a2f2f7472617669732d63692e6f72672f6a6179746170682f526174654c696d697442756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/jaytaph/RateLimitBundle)[![Code Coverage](https://camo.githubusercontent.com/437014e65a74bdf9f9b29b2db83b49050b2eac792c020bc9d21255755446fd29/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a6179746170682f526174654c696d697442756e646c652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/jaytaph/RateLimitBundle/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/5ea9424d17fd4aefbfbf90fca9d67e7cac0440958593aa60bdb2fe65ada3d42d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a6179746170682f526174654c696d697442756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/jaytaph/RateLimitBundle/?branch=master)

[![Latest Stable Version](https://camo.githubusercontent.com/97a5dd8d25b7a87294b783bc4f31b2d418d6ad4e923466d832ecb9687ac9701e/68747470733a2f2f706f7365722e707567782e6f72672f496e73746173656e742f726174656c696d69742d62756e646c652f762f737461626c652e737667)](https://packagist.org/packages/Instasent/ratelimit-bundle) [![Total Downloads](https://camo.githubusercontent.com/df7c6fcc4cbe65811637dc85709e30932d04ac868d19543456a851a6faa82e7f/68747470733a2f2f706f7365722e707567782e6f72672f496e73746173656e742f726174656c696d69742d62756e646c652f646f776e6c6f6164732e737667)](https://packagist.org/packages/Instasent/ratelimit-bundle) [![Latest Unstable Version](https://camo.githubusercontent.com/65f9688c83d9929d6b6e99ddf697feddf8d8193d2b0f36b68cc1d36ae651c942/68747470733a2f2f706f7365722e707567782e6f72672f496e73746173656e742f726174656c696d69742d62756e646c652f762f756e737461626c652e737667)](https://packagist.org/packages/Instasent/ratelimit-bundle) [![License](https://camo.githubusercontent.com/1bb193346b14bc14df27dc6f15c7ff1e2b8330e8e50287468ab81ed06df27835/68747470733a2f2f706f7365722e707567782e6f72672f496e73746173656e742f726174656c696d69742d62756e646c652f6c6963656e73652e737667)](https://packagist.org/packages/Instasent/ratelimit-bundle)

This bundle provides enables the `@RateLimit` annotation which allows you to limit the number of connections to actions. This is mostly useful in APIs.

The bundle is prepared to work by default in cooperation with the `FOSOAuthServerBundle`. It contains a listener that adds the OAuth token to the cache-key. However, you can create your own key generator to allow custom rate limiting based on the request. See *Create a custom key generator* below.

This bundle is partially inspired by a GitHub gist from Ruud Kamphuis:

Features
--------

[](#features)

- Simple usage through annotations
- Customize rates per controller, action and even per HTTP method
- Multiple storage backends: Redis, Memcached and Doctrine cache

Installation
------------

[](#installation)

Installation takes just few easy steps:

### Step 1: Add the bundle to your composer.json

[](#step-1-add-the-bundle-to-your-composerjson)

If you're not yet familiar with Composer see . Add the InstasentRateLimitBundle in your composer.json:

```
{
    "require": {
        "Instasent/ratelimit-bundle": "1.x"
    }
}
```

Now tell composer to download the bundle by running the command:

```
php composer.phar update Instasent/ratelimit-bundle
```

### Step 2: Enable the bundle

[](#step-2-enable-the-bundle)

Enable the bundle in the kernel:

```
