beyondcode/laravel-fixed-window-limiter
A Laravel rate limiter using fixed time windows instead of the default sliding windows, so limits reset predictably. Useful for API throttling where you need strict, evenly spaced counters per window.
X-RateLimit-Remaining and reset times. If the product's job is to stop our outbound calls before a partner returns 429s — and to show customers a "calls remaining / resets at :00" panel that matches the partner's mental model — fixed windows are the right semantics. This package is a useful reference implementation for that requirement, not necessarily the production dependency.INCR + PEXPIRE, fork with a named owner, or skip entirely. Those are the four real options; the package is one column in the table.Retry-After vs. reset-timestamp headers, error copy, and whether the countdown a user sees is honest. Fixed windows make "resets at :00" truthful; decay-based throttling does not. That is a product-facing decision worth making deliberately.Consider it only when all of the following hold:
predis and phpredis), and an eventual removal plan.Look elsewhere when:
Illuminate\Cache\RateLimiter plus throttle: middleware already delivers fixed-window limiting on any cache store, including Redis, with a supported upgrade path.Executive summary. This package solves a narrow, well-understood problem — fixed-window rate limiting for Laravel and Redis — with predictable reset times and a familiar API. It is also archived, last released January 2020, with 67 stars and zero dependents, and carries no support or security-response path. Recommendation: do not add it to critical paths for new work. If fixed-window limits are genuinely required, use framework primitives or fund a small internal utility (~30–50 lines over Redis INCR + PEXPIRE) with a named owner and tests. If it already exists in the codebase, contain it: document the owner, pin the version, and schedule replacement. Either way this is a governance decision — whether we accept an unmaintained dependency in a reliability-adjacent area — not a build-cost one.
Engineering summary. Mechanically it is a small MIT-licensed limiter over Redis cache, and effectively a redundant abstraction: Laravel's first-party RateLimiter already implements fixed windows on any store. Its 2020 constraints will likely require --ignore-platform-reqs, a Composer alias, or a fork to run on Laravel 10–12 — any of which converts an install into owned code. If adopted: vendor and pin it; verify atomicity of the increment-and-expiry path (a non-atomic INCR + EXPIRE can permanently throttle an identity if the process dies between calls); confirm fail-open vs. fail-closed behavior under Redis outage; add boundary-burst tests; validate against PHP 8.1–8.3 / Laravel 10–12 / Redis 6–7 with both clients; and canary one low-risk endpoint behind a feature flag. Prefer RateLimiter or a tested in-house Lua-backed limiter unless this package is already embedded in a legacy path — in which case treat the work as a migration with a documented rationale, not an adoption.
How can I help you explore Laravel packages today?