acrobat/recaptcha-bundle
Symfony2 form integration for Google reCAPTCHA. Install via Composer, register the bundle, and configure your public/private keys in config.yml. Supports disabling per environment and optional Ajax loading, helping protect forms from spam and bots.
spatie/laravel-recaptcha). This package’s architecture is incompatible without heavy refactoring.symfony/form, symfony/validator) may clash with Laravel’s autoloading or service container.config.yml structure must be translated to Laravel’s config/recaptcha.php or environment variables.spatie/laravel-recaptcha (v3 support, actively maintained) exist.FormBuilder must be replaced with Laravel’s Form Requests or API validation.spatie/laravel-recaptcha (v3, maintained).symfony/recaptcha-bundle (official, modern).// app/Providers/RecaptchaServiceProvider.php
public function register()
{
$this->app->singleton('recaptcha', function () {
return new AcrobatRecaptchaBundle\Service\RecaptchaService(
config('recaptcha.site_key'),
config('recaptcha.secret_key')
);
});
}
FormType with Laravel Form Request validation:
use Illuminate\Foundation\Http\FormRequest;
use Spatie\Recaptcha\Laravel\Recaptcha;
class ContactFormRequest extends FormRequest
{
public function validateRecaptcha()
{
$recaptcha = app(Recaptcha::class);
if (!$recaptcha->verify($this->input('g-recaptcha-response'))) {
throw new \Exception('Invalid recaptcha');
}
}
}
public function handle($request, Closure $next)
{
if (!$request->has('g-recaptcha-response')) {
return response()->json(['error' => 'Recaptcha required'], 403);
}
if (!app(Recaptcha::class)->verify($request->input('g-recaptcha-response'))) {
return response()->json(['error' => 'Invalid recaptcha'], 403);
}
return $next($request);
}
{{ form_widget(form) }} must be replaced with Laravel Blade or Inertia.js.form.submit) need Laravel service container bindings..env (not config.yml)..env:
RECAPTCHA_SITE_KEY=6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI
RECAPTCHA_SECRET_KEY=6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe
spatie/laravel-recaptcha)..env supports per-environment keys (e.g., .env.staging, .env.prod).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Google reCAPTCHA API downtime | Forms/APIs break | Fallback to honeypot fields or manual review. |
| PHP 8.x compatibility issues | Bundle breaks | Fork and patch dependencies. |
| High false-positive rate | User frustration | Monitor and adjust score thresholds (if using v3). |
| Security vulnerability | Data breach | Isolate recaptcha logic in a micro-service. |
| Abandoned package | No future updates | Plan migration to spatie/laravel-recaptcha. |
How can I help you explore Laravel packages today?