laravel-rate-limiting

v2026.09.24

Apply per-user and per-route limits with RateLimiter and throttle middleware; use backoffs and headers for clients

GitHub
安装命令
npx skhub add noartem/laravel-rate-limiting
Markdown
SKILL.md

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
发现
标签

此技能尚未发布标签。

版本
最新版本元数据

版本

v2026.09.24

发布时间

2026年9月24日

分类

未分类

许可证

未指定

源路径

skills/laravel-rate-limiting-and-throttle

默认分支

main

最新提交

0002f35

Tree SHA

3db1f86