gregwar/captcha
gregwar/captcha is a lightweight PHP library for generating customizable CAPTCHA images with distortion, fonts, and backgrounds. Build, save, output, or inline them, then validate user input with testPhrase().
gregwar/captcha is MIT-licensed, Composer-installable, and has an API narrow enough to learn from one README read. This is a "borrow" decision, not a "build" one.PhraseBuilder(4) for length and alphabet, digit-only phrases for low-literacy contexts, configurable width/height/font, JPEG/PNG/GIF output, background images, transparency, and distort/scatter/line effects. Registration, password reset, contact forms, guest checkout, and admin login can each be tuned for friction vs. solvability without adding a second dependency.Adopt it when:
ext-gd fails at runtime, not at install.getPhrase() and testPhrase() are primitives; the Laravel glue (session key, TTL, invalidate-on-success, validation rule, rate limiter) is a small but real deliverable — scope it as such.marcogermani87/filament-captcha instead of hand-rolling the view/validation wiring.Look elsewhere when:
buildAgainstOCR() is honest about its own ceiling: it loops until ocrad fails, which says little about a current ML solver. At that threat level the answer is risk-based/invisible scoring, not a harder image.captcha validation rule, Blade component. This is framework-agnostic; if that glue exceeds your maintenance appetite, evaluate a Laravel-specific wrapper.For executives: We have public forms — signup, password reset, contact, guest checkout — that scripted abuse can hit at near-zero cost to the attacker. We can close that gap with a free, MIT-licensed library we generate and verify ourselves: no new vendor, no per-request fee, no user data leaving our systems, no procurement or DPA cycle, and no external call in the request path. The integration is roughly one engineering day plus tests, and the recent releases already fixed the weak-randomness issue that would have been the obvious audit finding. It is a low-cost hardening line item, not a platform bet: I'd recommend piloting on two or three high-abuse endpoints, measuring spam volume before and after, and deciding on broader rollout from that data. The one thing it does not solve is accessibility — image challenges are a known WCAG problem — so the pilot should ship alongside a documented alternative path, or we should not ship it at all.
For engineering: Framework-agnostic PHP library, composer require gregwar/captcha, requires PHP 8.2+ and GD. CaptchaBuilder gives you build(), inline(), output(), save(), getPhrase(), testPhrase(). We own the Laravel wiring: session storage with TTL, single-use invalidation, a custom validation rule, a cache-busting image route, and a rate limiter in front of the verify endpoint. Keep phrase comparison constant-time and never log the phrase.
How can I help you explore Laravel packages today?