DEV Community

Morcos Gad
Morcos Gad

Posted on

Limit User Requests - Rate Limiting Laravel

Today we will learn how to set the user to reach our endpoint how many times per minute correctly in order to protect our application and keep no problems due to the number of requests in excess of the limit and is often used with APIS .
For more information, visit the source :-
https://laravel.com/docs/9.x/routing#rate-limiting
https://www.youtube.com/watch?v=TQSDi3e0TxU

  • An example of fetching user data, but the user has the right to call the request three times every minute

Image description

in RouteServiceProvider.php

Image description

Image description

  • Here we want to customize a message that appears when user attempts fail

Image description

  • To stop the feature for the time being and make the user free in the number of requests we use the function none()

Image description

I hope you benefit from the article and I wish you a happy code.

Top comments (3)

Collapse
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
morcosgad profile image
Morcos Gad

thanks for your advice,
I will make use of these points next time. Please visit my other frying pans. You may find what pleases you :)

Collapse
 
alphaolomi profile image
Alpha Olomi

Please excuse my tone if i sounded rude/harsh.