- How do I integrate captchaapi.eu into a Laravel 12/13 form without Livewire?
- Use the Blade widget `<x-captchaapi::widget />` in your layout’s `<head>` and add `data-captcha` to your form fields. The package includes a validation rule (`ValidCaptcha`) to verify submissions server-side. No Livewire is required for basic functionality.
- Does this package work with Laravel Octane (Swoole/RoadRunner)?
- Yes, the package is stateless and uses request-scoped memoization, making it fully compatible with Laravel Octane. Verification calls are stateless and won’t interfere with async workers.
- How do I test CAPTCHA validation in Laravel’s PHPUnit tests?
- Enable the fake mode with `FakeCaptchaapi::enable()` before tests. The package supports mocking CAPTCHA responses, including edge cases like failed validation or rate limits, making it easy to test form submissions.
- What happens if captchaapi.eu goes down? Can I fallback to another CAPTCHA?
- The package defaults to `fail_open=true`, meaning forms will submit without CAPTCHA if the service is unavailable. For critical paths, set `fail_open=false` in `.env` to block submissions. However, switching to another CAPTCHA service would require rewriting validation logic.
- Is the CAPTCHA widget compatible with Tailwind CSS or other frontend frameworks?
- The Blade widget is a self-contained script that injects minimal HTML and CSS. It doesn’t rely on Tailwind or other frameworks, but you may need to override its default styling to match your design system.
- How does Livewire integration work? Do I need Livewire 4?
- Livewire integration is optional but requires Livewire 4. Use the `WithCaptcha` trait in your Livewire components and call `validateWithCaptcha()` in your rules. The package provides a Livewire-specific Blade component for seamless SPA-like interactions.
- Can I use this CAPTCHA for high-traffic forms (e.g., 10,000+ submissions/day)?
- The package supports high-volume forms, but you should monitor rate limits via `CAPTCHAAPI_DEBUG=true`. Consider caching validation results for logged-in users or implementing a local fallback (e.g., honeypot) during peak loads.
- What Laravel versions and PHP versions are supported?
- The package officially supports Laravel 12 and 13, with PHP 8.2+. It aligns with Laravel’s current LTS support and includes no breaking changes for these versions. Older Laravel versions are not supported.
- How do I handle CAPTCHA failures or rate limits in the UI?
- The package provides default error messages for failed validations or rate limits. You can customize these in your Blade templates or use JavaScript to handle `CAPTCHAAPI_ERROR` events emitted by the widget.
- Is there a way to skip CAPTCHA for logged-in users or admins?
- The package doesn’t include built-in logic for skipping CAPTCHA, but you can implement this via middleware or custom validation rules. For example, exclude logged-in users by checking `auth()->check()` before validating.