PHPackages                             drefined/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. drefined/ratelimit-bundle

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

drefined/ratelimit-bundle
=========================

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

1.7.0(10y ago)032MITPHP

Since Jun 23Pushed 8y ago1 watchersCompare

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

READMEChangelogDependencies (3)Versions (11)Used By (0)

NoxlogicRateLimitBundle
=======================

[](#noxlogicratelimitbundle)

[![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/4de0da54a97e9bd85f9db88215c1c874ae0dae163c2ee109d1366caa58a91d64/68747470733a2f2f706f7365722e707567782e6f72672f6e6f786c6f6769632f726174656c696d69742d62756e646c652f762f737461626c652e737667)](https://packagist.org/packages/noxlogic/ratelimit-bundle) [![Total Downloads](https://camo.githubusercontent.com/5231cfc2f6d054556f45a06be3fcf46d60c706cdbb030f8f164eda4f7c4b8709/68747470733a2f2f706f7365722e707567782e6f72672f6e6f786c6f6769632f726174656c696d69742d62756e646c652f646f776e6c6f6164732e737667)](https://packagist.org/packages/noxlogic/ratelimit-bundle) [![Latest Unstable Version](https://camo.githubusercontent.com/f337bcfccf6332b484029ee30a0eb3355689388a7a2af9b1c44c5b839ceaee94/68747470733a2f2f706f7365722e707567782e6f72672f6e6f786c6f6769632f726174656c696d69742d62756e646c652f762f756e737461626c652e737667)](https://packagist.org/packages/noxlogic/ratelimit-bundle) [![License](https://camo.githubusercontent.com/ec756dc5493d68b5b5e3679a112cb9e44f30de8aaa35b737a208e094ac6a5441/68747470733a2f2f706f7365722e707567782e6f72672f6e6f786c6f6769632f726174656c696d69742d62756e646c652f6c6963656e73652e737667)](https://packagist.org/packages/noxlogic/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 NoxlogicRateLimitBundle in your composer.json:

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

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

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

### Step 2: Enable the bundle

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

Enable the bundle in the kernel:

```
