andydefer/laravel-nemesis
Laravel Nemesis is a lightweight Laravel package by andydefer that installs via Composer and registers through a service provider, adding configurable functionality to your app. Early-stage project with limited adoption—check the source and docs before production use.
Architecture fit. Nemesis is a conventional Laravel package: a service provider (with middleware auto-registration), a nemesis middleware alias, publishable config/migrations, and a full Artisan command surface (create, reset, block/unblock, list). That is a low-friction fit for any Laravel HTTP/API codebase — it sits in the request pipeline alongside existing auth and does not require changes to controllers or route definitions beyond attaching the middleware. The domain-scoped token model (a token belongs to a domain, with per-token CORS and quotas) implies a centralised token table plus a per-request counter, which is a standard and reviewable design.
Integration feasibility. Feasible in days, not weeks, for a team already on Laravel. The v1.0.0 feature set covers the minimum viable surface for an internal or partner-facing API gateway concern: token issuance, per-domain isolation, CORS, quota enforcement, and operator tooling. Automatic middleware registration and optimised uninstall/cleanup reduce the cost of a trial — we can install, evaluate, and back out without residue.
Technical risk. Several risks are material at this stage:
?token= in addition to the Authorization header is convenient but causes credentials to land in access logs, proxy logs, browser history, and referrer headers. This should be opt-in and disabled by default for anything externally exposed.UPDATE ... SET counter = counter + 1) or still read-modify-write determines whether quotas are accurate under load.Key questions.
Stack fit. Best suited to Laravel APIs with many machine clients partitioned by domain or tenant, where the need is coarse-grained call quotas plus simple token lifecycle — internal service-to-service, partner integrations, trial/sandbox tiers. It is a poor fit where OAuth2 scopes, delegated user consent, or token rotation with refresh flows are required; Sanctum or Passport remain the right answer there, with Nemesis layered on top purely for quota and domain policy.
Migration path. Treat as additive, not a replacement. Publish config and migrations, run them in a non-production environment first, register the middleware on a single low-risk route group, then issue tokens through Artisan. Existing authentication stays in place; Nemesis is inserted as an authorisation/quota gate after identity is established. This keeps rollback to "remove middleware from the route group" rather than "re-architect auth".
Compatibility. Verify against our pinned Laravel/PHP matrix before commitment — this is the single gating check. Also verify coexistence with any existing CORS middleware (avoid duplicate Access-Control-* headers) and with any global rate limiter, since two independent quota systems will produce confusing 429s.
Sequencing.
Maintenance. Low day-to-day effort — the package is self-contained, migrations are reversible, and cleanup/uninstall is explicitly handled. The real maintenance exposure is upstream: one maintainer, no stated release cadence, and a major-version boundary just crossed. Pin the version exactly, avoid ^1.0 drift on a first stable, and budget for the possibility of vendoring or forking within 12 months.
Support. Documentation is French-only and appears to be release-note-led rather than reference-led. Internal enablement will need a short English runbook covering token issuance, quota reset scheduling, block/unblock, and the interpretation of nemesis:list output. There is no stated community, SLA, or security disclosure channel — assume self-support.
Scaling. The per-request counter write is the scaling ceiling. At high request volume against a shared relational table, row contention and write amplification will show up as latency on every protected call. Confirm whether the counter can be backed by Redis or an atomic increment before applying this to high-throughput endpoints; otherwise reserve it for moderate-volume domains. The token table itself will stay small and is not a concern.
Failure modes.
reset, clients fail permanently and the incident looks like an outage; the reset job is a hard prerequisite, not a nice-to-have.Ramp-up. Low for Laravel developers — the middleware-plus-Artisan pattern is idiomatic and needs little explanation. The ramp-up cost sits with operations and security review, not engineering: writing the runbook, defining the quota reset schedule, deciding query-param policy, and validating the fail-open/closed posture. Estimate one engineer-week of combined diligence and pilot work before production enforcement.
How can I help you explore Laravel packages today?