Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8047081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:59:37+00:00 2026-06-05T05:59:37+00:00

I am currently writing a REST API using Symfony2. I started using Symfony2 one

  • 0

I am currently writing a REST API using Symfony2. I started using Symfony2 one month ago and i’m currently facing a technical difficulty.

While writing my API I wanted to rate limit the API calls by IP addresses or by user (i.e if the user is logged in I’m using his id, a timestamp and his IP address to keep a trace of his connection, if he’s not logged in, I just save his IP address and a timestamp in my database).
To do this I wrote a service implementing VoterInterface and who’s called by Symfony everytime a user accesses a controller and checks whether he didn’t exceed the API rate limit by hour or by day (they’re both hardcoded)). This works fine until now.

But I want something more customizable and scalable, I would like to set up for each controller their own limit so I could control and change easily my API rate limit for each one. My idea is to use an annotation like the ones you can use with the JMSSecurityExtraBundle and specify on the top of each of my controllers something like :

/**
 * My API - UserController::registerAction
 *
 * @RateLimit(hour="200", day="2000")
 */
public function registerAction($format)

And then retrieve the annotation informations in my rate limiter class to fill the limits informations.
The problem is I didn’t manage to find how and I need some help. My solution works, I just need something more powerfull. I already thought about storing these informations in a YAML file or in a database, but this is not a good solution to me since it creates an unnecessary dependency between my controllers and a persistence.

Thank you in advance for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T05:59:38+00:00Added an answer on June 5, 2026 at 5:59 am

    See the AOP Bundle — it provides the means for doing what you want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently writing a java REST Web Service using Netbeans and Glassfish. The
I am currently writing a rest API in python with the microframework Flask. It's
I'm currently writing myself a little C# back up program. I'm using a standard
I'm currently writing a simple multicaster module. Only one process can open a proc
I'm currently writing a couple of MVC sites using Kohana as my framework. Each
Writing an iPhone app, and I'm getting my data from a REST API that
I'm writing a library that wraps around a REST API. The wrapper I'm creating
I'm writing an iPhone Application using the ASIHTTPRequest (http://allseeing-i.com/ASIHTTPRequest/) library for REST interactions to
I am currently adding a REST API over http to an online service and
I am in the process of writing a Java REST API for a reservation

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.