- How do I install Filament Turnstile for Laravel?
- Run `composer require coderflex/filament-turnstile` and specify the correct version for your Filament (e.g., `^4.0` for v5, `^3.0` for v4). Add your Cloudflare `TURNSTILE_SITE_KEY` and `TURNSTILE_SECRET_KEY` to `.env`. No additional config is needed for basic usage.
- Does this package work with Filament v3 or v4?
- Yes, it supports Filament v2 through v5. Use version `^1.0` for v2, `^2.0` for v3, `^3.0` for v4, and `^4.0` for v5. Check the [README](https://github.com/coderflexx/filament-turnstile) for version-specific installation commands.
- Will this break my existing Filament forms?
- No, the package integrates as a standalone form component. Add it to your forms via `Turnstile::make('captcha')`—it won’t interfere with existing fields or workflows. Test on a staging environment first for critical forms.
- How does server-side validation work?
- The package relies on `laravel-turnstile` for backend validation, which verifies Cloudflare’s response tokens. Failed validations trigger Filament’s built-in error handling. Ensure your `.env` has the correct `TURNSTILE_SECRET_KEY` for secure validation.
- Can I customize the Turnstile theme or language?
- Yes, you can pass options like `theme: 'light'` or `language: 'es'` when initializing the component. For dynamic settings (e.g., per user locale), use Filament’s form modifiers or JavaScript to update the Turnstile instance before submission.
- What’s the impact on page load performance?
- The package lazy-loads Turnstile’s JavaScript/CSS to avoid blocking initial render. Benchmark your forms with/without it—most users report minimal impact, especially on forms where CAPTCHA isn’t always visible (e.g., conditional fields).
- How do I handle failed CAPTCHA submissions?
- Filament automatically displays validation errors if Turnstile’s response fails. For custom messages, override the error handling in your form’s `rules()` or use Filament’s `afterStateUpdated` to reset the CAPTCHA challenge dynamically.
- Is there support for Turnstile’s enterprise features?
- Currently, the package focuses on core Turnstile functionality. For enterprise features (e.g., custom branding), check Cloudflare’s [Turnstile API docs](https://developers.cloudflare.com/turnstile/) and extend the package via JavaScript or server-side hooks in `laravel-turnstile`.
- Can I use this with Filament’s login or registration forms?
- Absolutely. Replace the default CAPTCHA in Filament’s auth forms by registering the `Turnstile` component in your `AppServiceProvider` or form definition. Example: `use Turnstile::make('captcha')->rules(['required', 'turnstile'])` in your login form.
- What alternatives exist if I don’t want Cloudflare Turnstile?
- For Filament, consider `spatie/laravel-honeypot` (for honeypot traps) or `filament/forms` extensions for reCAPTCHA. However, Turnstile offers better privacy and lower JavaScript overhead. If you need reCAPTCHA, use `laravel-recaptcha` with Filament’s custom components.