Laravel rate limiting and throttle
Skill ComeOnOliver/skillshub/skills/noartem/skills/laravel-rate-limiting-and-throttle
🧠The right skill, one API call. AI agent skills registry with token-efficient skill resolution. 5,000+ skills from 500+ top repos.
npx -y skills add ComeOnOliver/skillshub --skill laravel-rate-limiting-and-throttleAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
SKILL.md
0.6 KB, as published. Nobody here has run it
Rate Limiting and Throttle
Protect endpoints from abuse while keeping UX predictable.
Commands
// App\Providers\RouteServiceProvider
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
});
// routes/api.php
Route::middleware(['throttle:api'])->group(function () {
// ...
});
Patterns
- Scope limits by user when authenticated; fall back to IP
- Communicate limits to clients via standard headers
- Provide sensible 429 responses with retry hints
- Separate bursty endpoints into specialized limiters