lukeraymonddowning/honey
A simple Laravel honeypot package that protects forms from spam bots without CAPTCHAs. Add a hidden field, and Honey silently rejects submissions that fill it, keeping forms user-friendly and spam-free.
Architecture fit. Honey is a thin, framework-native package: a middleware in the HTTP kernel, a Blade directive (@honey) that injects a hidden honeypot field plus an encrypted timestamp/parent-name payload, a cache-backed IP blocklist, and an optional Recaptcha verifier. It ships no migrations, no queues, and no long-running processes, so it slots into the request lifecycle without touching domain code. This is a strong fit for a traditional server-rendered Laravel monolith with HTML form posts (contact, registration, newsletter, checkout). It is a weak fit for API-only services, JSON clients, or mobile apps, because the honeypot contract assumes a rendered form and a full page submit — applying the middleware broadly to /api/* would reject legitimate clients that never had a field to fill.
Integration feasibility. Low. Composer install, config publish, middleware registration in the web group (or per-route group), and one directive per form. The Recaptcha path adds key provisioning, front-end script inclusion, and consent-banner implications under GDPR/ePrivacy. Realistic estimate for a mid-size app: 1–3 engineer-days to instrument primary public forms, plus QA time for false-positive testing.
Technical risk. The dominant risks are false positives and misconfiguration, not defects:
$request->ip() returns the load balancer or Cloudflare edge IP; blocking it can lock out a large fraction of traffic. Conversely, CGNAT and corporate NAT mean one bot can get an entire office blocked.array driver makes blocking per-request and effectively useless; multiple app nodes with non-shared caches produce inconsistent enforcement.Key questions.
APP_KEY shared, as required?Stack fit. Best suited to Laravel 9–11 monoliths on PHP 8.1+, using Redis or database cache, behind a known proxy (configure TrustProxies). Recaptcha requires outbound HTTPS from both browser and app server. If the estate is Inertia/React or a separate SPA, treat Honey as a server-side-only component and hand-build the client field.
Migration path. Adopt in a narrow wedge rather than globally: start with the two or three highest-abuse public forms, run the honeypot in observe-only mode (custom wrapper middleware that logs would-be blocks), compare flagged submissions against a human-reviewed sample, then enable blocking. Recaptcha should be a later, separately gated step because it changes the user-facing UX and consent posture.
Compatibility. Verify: Laravel version constraint, PHP constraint, cache drivers exercised in tests, interaction with EncryptCookies/session middleware ordering, and coexistence with any existing WAF, rate limiter, or legacy CAPTCHA. Watch middleware ordering — Honey should run after session and proxy resolution. Do not register it on the global stack; scope it to the web group or explicit route groups.
Sequencing.
composer audit, read the middleware and blocklist code (it is small), confirm license and maintainer.@honey to one form.Maintenance. Small surface area and MIT licensing make it cheap to maintain and trivial to vendor or fork if the upstream goes quiet. The cost is dependency hygiene: pin the version, review changelogs, and re-run composer audit on the normal cadence. Budget a few hours per quarter, plus rework if Laravel majors change middleware or Blade internals.
Support. No SLA, single-maintainer risk, community-issue-only support. The internal runbook matters more than upstream docs: how to inspect the blocklist, how to unblock an IP, which cache key namespace to clear, and how to temporarily disable enforcement during an incident. Train first-line support on "user locked out" as a distinct ticket category with a fast unblock path.
Scaling. Per-request cost is negligible — one cache read on submission paths, plus an outbound Recaptcha call only when that layer fires (expect 100–400ms added to those submissions). The blocklist is TTL-bounded, so cache growth is proportional to abuse volume, not user volume; Redis is the right store. Under horizontal scaling, a shared cache is mandatory for consistent enforcement. The design does not scale to edge-level filtering — pair it with a WAF/CDN rate limiter rather than expecting Honey to absorb volumetric attacks.
Failure modes. Ranked by blast radius: (1) proxy IP blocking due to misconfigured trusted proxies — can take down all traffic; (2) cache misconfiguration making blocking a no-op or, worse, non-deterministic across nodes; (3) honeypot false positives locking out real users via autofill; (4) Recaptcha outage with fail-closed policy blocking all submissions; (5) middleware applied to API routes, breaking integrations; (6) bot adaptation over time eroding effectiveness, requiring periodic re-tuning. Each needs a documented detection signal and a one-step rollback (remove middleware from the group).
Ramp-up. One to two days for a Laravel-fluent engineer to be productive; the concepts (honeypot, encrypted timestamp, cache TTL blocklist) are simple. The real ramp-up cost is organizational: teaching QA to test with password managers, autofill, and JS disabled; teaching support to triage lockouts; and getting product sign-off that a small, tunable false-positive rate is an acceptable trade for the spam reduction. Set an explicit success metric up front — e.g., spam submissions down X% with false-positive rate under Y% — and measure it at day 30, because the package's value is entirely empirical.
How can I help you explore Laravel packages today?