captchaapi/laravel
Official Laravel SDK for captchaapi.eu (EU-hosted, GDPR-friendly proof-of-work CAPTCHA). Includes Blade widget/component, server-side verification + validation rule, and optional Livewire 4 support. PHP 8.2+, Laravel 12/13.
ValidCaptcha rule and WithCaptcha trait integrate seamlessly into existing Laravel workflows (e.g., form validation, Livewire components).composer require, vendor:publish, .env config). No database migrations or complex setup required.WithCaptcha trait and livewire-form component reduce boilerplate for Livewire users, a key differentiator vs. generic CAPTCHA solutions.captchaapi.eu (single provider). If the service deprecates or changes pricing, migration effort could be high.fail_open=true (submissions pass if API fails) may bypass security during outages. Requires explicit opt-in for sensitive actions (e.g., logins).fail_open=false.captchaapi.eu? High-traffic sites may face unexpected costs.captchaapi.eu fails? The package’s fail_open mode may not suffice for critical paths.data-captcha attributes). No React/Vue-specific integrations, but the widget is framework-agnostic..env.ValidCaptcha or the captcha rule.<x-captchaapi::widget /> to layouts.data-captcha attributes (or use the Livewire wrapper).WithCaptcha trait and validateWithCaptcha().<x-captchaapi::livewire-form>.fail_open, timeout, or locale based on testing.CAPTCHAAPI_ENABLED=false in non-production environments.required, email).FakeCaptchaapi enables mocking for unit/feature tests without external dependencies.| Step | Priority | Effort | Dependencies |
|---|---|---|---|
| 1. Install & Configure | High | Low | Laravel 12/13, PHP 8.2+ |
| 2. Backend Validation | High | Medium | Existing form handlers |
| 3. Frontend Widget | Medium | Low | Blade/Livewire templates |
| 4. Livewire Integration | Low | Medium | Livewire 4+ |
| 5. Error Handling | Medium | Low | Custom CSS/Blade for status messages |
| 6. Testing | High | Medium | FakeCaptchaapi |
CHANGELOG.md).fail_open, locale) is controlled via .env.CAPTCHAAPI_DEBUG=true logs timing to browser console.@error system (customizable via <x-captchaapi::error />).data-captcha attributes or widget script.secret_key or network timeouts (adjust CAPTCHAAPI_VERIFY_TIMEOUT).WithCaptcha trait is used and validateWithCaptcha() is called.captchaapi.eu.CAPTCHAAPI_PRELOAD=lazy), reducing initial load time.data-captcha-mode="event") avoids full-page reloads.CAPTCHAAPI_VERIFY_TIMEOUT under high traffic; increase if API latency spikes.rate_limited status messages.| Scenario | Impact | Mitigation |
|---|---|---|
| API Unreachable | Submissions pass (fail_open=true) or fail (fail_open=false). |
Set fail_open=false for sensitive actions; add retry logic. |
| Invalid Secret Key | All verifications fail. | Monitor Laravel logs for 401 Unauthorized errors. |
| Frontend Widget Fails | Forms submit without CAPTCHA. | Use <x-captchaapi::error /> to surface UX issues. |
| Livewire Event Misconfiguration | CAPTCHA response not captured. | Verify data-captcha-mode="event" and hidden input inclusion. |
| Secret Key Compromise | Bot submissions may succeed. | Rotate keys via dashboard; use Revoke immediately for suspected breaches. |
FakeCaptchaapi is well-documented, but real-world failure scenarios (e.g., API throttling) lack examples.CAPTCHAAPI_MODE (submit/event) and preload options need clearer use-case guidance.data-captcha attributes and status messages.fail_open and validation error handling.How can I help you explore Laravel packages today?