#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →

Rate Limiting for API Requests

Rate limiting protects an API from abuse, accidental infinite loops in client code, and traffic spikes, by capping how many requests a client can make within a given time window.

The throttle Middleware

Laravel ships with a throttle middleware that can be applied to any route or route group.

Route::middleware('throttle:60,1')->group(function () {
    Route::get('/posts', [PostController::class, 'index']);
});

This example allows 60 requests per 1 minute per client.

Named Rate Limiters

For more control, rate limiters can be defined in a service provider using the RateLimiter facade, keyed by user ID or IP address.

RateLimiter::for('api', function (Request $request) {
    return Limit::perMinute(100)->by($request->user()?->id ?: $request->ip());
});

What Clients See When Limited

With the API itself secured and throttled, the course now shifts from request/response handling to background processing, starting with events and listeners.

Ready to master Laravel Training Course?

Join Uncodemy's hands-on Laravel program and build real, production-ready applications.

Explore Course