DEV Community

Morcos Gad
Morcos Gad

Posted on

3 1

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.

Sentry blog image

How to reduce TTFB

In the past few years in the web dev world, we’ve seen a significant push towards rendering our websites on the server. Doing so is better for SEO and performs better on low-powered devices, but one thing we had to sacrifice is TTFB.

In this article, we’ll see how we can identify what makes our TTFB high so we can fix it.

Read more

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.

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay