josiasmontag/laravel-recaptchav3
Laravel Recaptcha V3 is a lightweight package for backend validation of Google reCAPTCHA v3. It provides JS initialization, invisible form fields, and a recaptchav3 validator accepting an action and minimum score, configured via site and secret keys.
Architecture fit
FormRequest::rules() / $request->validate() pipeline, so it composes with existing form objects rather than requiring an architectural change.siteverify REST contract, (2) the token transport convention (hidden g-recaptcha-response field), (3) two env vars (RECAPTCHAV3_SITEKEY, RECAPTCHAV3_SECRET).grecaptcha.execute) is the implementing team's responsibility — this is the single largest hidden cost in the assessment.Integration feasibility
composer require, two env vars, optional vendor:publish for the config. A Laravel developer can have a rule firing in an afternoon.execute() to form submit, handling token single-use and ~2-minute TTL, and defining an action-naming convention that the backend rule can validate against.Http::fake) — this must be confirmed before adoption, otherwise CI will hit Google or need network stubbing.Technical risk
Key questions for the maintainer/team
action matches the expected action (prevents cross-form token reuse)?Stack fit
FormRequest classes without touching controllers.Migration path
Compatibility
composer.json; do not float a caret range on a single-maintainer dependency in a production app.Sequencing
execute(sitekey, {action}) and injects the token; establish the action naming convention here.Maintenance
app/ is a realistic 1-day contingency if the project is abandoned.Support
Scaling
Failure modes
| Mode | Symptom | Mitigation |
|---|---|---|
| Google 5xx/timeout | Protected forms error or silently pass | Explicit fail-open/fail-closed decision per form; timeouts configured; circuit-breaker or grace window for sensitive flows |
| Invalid/expired/duplicate token | Legit users rejected | Token generated at submit-time, not page-load; client retry on token failure |
| Score below threshold | Rising rejection rate, support tickets | Observe-mode baseline first; per-form thresholds; manual-review fallback rather than hard block |
| Action mismatch | Tokens rejected or cross-form reuse | Enforce action binding in the rule; standardize naming |
| Missing/misconfigured keys | Silent pass or total failure | Startup/config assertion; synthetic check in staging |
| Client script blocked | Tokens never generated for privacy-conscious users | Detect missing token client-side and route to an alternative challenge or a monitored allow path |
| GDPR/privacy review gap | Compliance blocker discovered late | Legal review of the Google script before production rollout, not after |
Ramp-up
How can I help you explore Laravel packages today?