danie1net0/filament-hcaptcha
Add hCaptcha spam protection to Filament forms with this lightweight plugin. Easily configure keys, render the widget, and validate responses on login, registration, and custom forms—helping block bots while keeping setup simple for Laravel and Filament apps.
Install the package
composer require danie1net0/filament-captcha
Look here first
config/filament-captcha.php — the driver/site-key/secret-key settings. Publish it with php artisan vendor:publish --tag="filament-captcha-config" before touching anything else..env — every driver (reCAPTCHA v2/v3, hCaptcha, Turnstile) is driven by env-backed keys, so a blank key is the most common cause of a "widget doesn't render" report.First use case Add the captcha component to a form schema, typically a public-facing contact or registration form:
use Danie1net0\FilamentCaptcha\Forms\Components\Captcha;
public static function form(Form $form): Form
{
return $form->schema([
TextInput::make('name')->required(),
TextInput::make('email')->email()->required(),
Captcha::make('captcha'),
]);
}
Submit once in local to confirm the widget renders and the validation rule fires, then verify again with production keys — reCAPTCHA keys are domain-scoped, so localhost behaviour and deployed behaviour are not the same.
Grid, Section, and ->columnSpanFull(). For narrow layouts, let it span the full width rather than putting it in a 1/3 column — the widget has a fixed intrinsic width and will look cramped otherwise (this is exactly the class of issue v1.1.2 addressed by centering the widget and fixing v2 rendering).Captcha::make('captcha') into each resource.RateLimiter/throttle middleware on the underlying route or Livewire action for meaningful abuse protection.->rule() on top of it, as double-verification against the provider API will consume tokens and can fail the second call.Http::fake()); attempting real verification in CI will fail because tokens are single-use and domain-bound.localhost if you want local testing and any staging subdomain. A correct key that "works in prod but not staging" is almost always this.1.1.1 or below, the checkbox could render misaligned or fail to mount inside Filament's form wrapper. Upgrade before debugging CSS yourself.Content-Security-Policy needs script-src/frame-src entries for google.com, gstatic.com, hcaptcha.com, or challenges.cloudflare.com; otherwise the widget silently fails to appear.php artisan config:clear (and in production config:cache) — stale cached config is a frequent cause of "I changed the env and nothing happened".invalid-input-secret, timeout-or-duplicate) rather than surfacing it to the user; the raw error immediately tells you whether it's a key, domain, or token-reuse problem.How can I help you explore Laravel packages today?