Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

stsTheAnonymous's avatar

Get the api throttle

So, i want to ask because i cannot find it as far as now. I am using a throttle for the api calls and i have set it different between groups. For example the /api/login route, will have a limit of 3 requests per user. I am wondering if i can receive through route or middleware the throttle of the the route i just requested. Thanks a lot,

0 likes
4 replies
bobbybouwmann's avatar
Level 88

As far as I know, you can only access these variables inside the middleware itself.

You have two options here I guess. Use config files with the values so you can reference the same key in different places or you can set the variable inside the request in the middleware. I would personally go for option one.

stsTheAnonymous's avatar

Thanks a lot for your time and your answer. Yes config option is the best solution until now. Another question if you may know. I can register providers for certain routes to make lighter my app. For example, the /users needs only 4 providers so i want only those 4 to run with it.

I made until know one config with a callback for every group of routes.

I am wondering if i can manage it with another option.

Thanks a lot again.

PS: I am new at Laravel, excuse me for my bad "plays".

aon292's avatar

hey i have an error on the project of laravel

Please or to participate in this conversation.