dmishh/recaptcher
Recaptcher is a lightweight PHP library for Google reCAPTCHA, based on the official phplib. It supports the “lang” option and is designed to integrate cleanly with Symfony2 RecaptchaBundle. Includes basic roadmap for timeouts and more translations.
Validator, FormRequest, or Middleware systems. The Symfony2 RecaptchaBundle compatibility suggests potential for Laravel’s Symfony bridge packages (e.g., symfony/http-foundation).lang parameter for localization, which can be dynamically set via Laravel’s config or user preferences..env integration would need manual setup.Validator facade or FormRequest validation? Will a custom validator or middleware be needed?bestmomo/laravel-recaptcha?Http client or Guzzle can replace the package’s HTTP layer if needed.Recaptcher class to the container, enabling dependency injection.Validator or FormRequest classes. Example:
use dmishh\Recaptcher\Recaptcher;
use Illuminate\Support\Facades\Validator;
$validator = Validator::make($request->all(), [
'g-recaptcha-response' => 'required|recaptcha',
]);
$validator->extend('recaptcha', function ($attribute, $value, $parameters, $validator) {
$recaptcher = app(Recaptcher::class);
return $recaptcher->verify($value);
});
Validator or a custom middleware.Config (e.g., read RECAPTCHA_SECRET from .env).LaravelRecaptcherService).bestmomo/laravel-recaptcha.HttpFoundation), ensure no conflicts with Laravel’s equivalents.FormRequest validation..env configuration, error handling).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| reCAPTCHA API downtime | Forms fail silently or show errors. | Implement fallback (e.g., honeypot fields). |
| Invalid API key | All validations fail. | Validate key on startup; use .env secrets. |
| Rate limit exceeded | 429 errors for users. | Cache responses; implement retry logic. |
| Package abandonment | No updates for API changes. | Fork or switch to maintained alternative. |
| PHP/Laravel version conflict | Integration breaks. | Test on CI pipeline; use feature flags. |
README for Laravel-specific setup).FormRequest, middleware, and API use cases.How can I help you explore Laravel packages today?