carlos-mg89/symfony-captcha-bundle
HttpFoundation, Form, or Validator) or a wrapper layer to bridge the gap.laravel-captcha, noCAPTCHA) may offer tighter integration.HttpFoundation (for request/response handling) or Validator (for validation logic) to adapt the bundle. However, this requires manual bridging of Symfony’s CaptchaBuilder and Laravel’s FormRequest/Validator.CaptchaService) that abstracts Symfony dependencies.CaptchaValidator) while rendering CAPTCHAs via Laravel’s Blade or a frontend library (e.g., hCaptcha).Doctrine or Filesystem for CAPTCHA storage. Laravel’s filesystem or database could be adapted, but this adds complexity.Container, EventDispatcher, or Form components may clash with Laravel’s DI container or service providers.DependencyInjection, Twig integration) may not align with Laravel’s architecture.google/recaptcha, laravel-captcha)?VerifyCsrfToken, ThrottleRequests)?symfony/http-foundation and symfony/validator as Laravel packages (via Composer).ServiceProvider to register the bundle’s services (e.g., CaptchaBuilder, CaptchaValidator) as Laravel bindings.CaptchaManager as a Laravel Facade (e.g., Captcha::generate()).laravel-captcha, noCAPTCHA).CaptchaService to abstract Symfony dependencies:
class CaptchaService {
public function generate(): string {
// Use Symfony's CaptchaBuilder via a wrapper
}
public function validate(string $userInput): bool {
// Integrate with Laravel's Validator
}
}
AppServiceProvider:
$this->app->singleton(CaptchaService::class, function ($app) {
return new CaptchaService(new SymfonyCaptchaAdapter());
});
FormRequest or use a custom validator:
use Illuminate\Support\Facades\Validator;
$validator = Validator::make($request->all(), [
'captcha' => ['required', function ($attribute, $value, $fail) {
if (!$this->app->make(CaptchaService::class)->validate($value)) {
$fail('Invalid CAPTCHA.');
}
}],
]);
Symfony\Component\HttpFoundation\Request with Laravel’s Illuminate\Http\Request.Symfony\Component\DependencyInjection by using Laravel’s Container.CaptchaStorage to use Laravel’s Cache or Database:
class LaravelCaptchaStorage implements CaptchaStorageInterface {
public function save(Captcha $captcha): void {
Cache::put("captcha_{$captcha->getId()}", $captcha);
}
public function find(string $id): ?Captcha {
return Cache::get("captcha_{$id}");
}
}
EventDispatcher with Laravel’s Events facade.Validator and FormRequest.Cache or Database.throttle middleware).symfony-captcha-bundle breaks (e.g., due to Symfony updates), the wrapper may need major refactoring.Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
The service 'captcha.builder' has a dependency on a non-existent service 'symfony.container'.
How can I help you explore Laravel packages today?