PHPackages                             ddr/filament-captcha - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. ddr/filament-captcha

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

ddr/filament-captcha
====================

Multi-provider captcha integration for Filament forms (hCaptcha, reCAPTCHA v2/v3, Turnstile)

v1.1.2(3mo ago)42.9k↑204.2%MITPHPPHP ^8.2CI passing

Since Dec 23Pushed 3mo agoCompare

[ Source](https://github.com/danie1net0/filament-captcha)[ Packagist](https://packagist.org/packages/ddr/filament-captcha)[ Docs](https://github.com/danie1net0/filament-captcha)[ RSS](/packages/ddr-filament-captcha/feed)WikiDiscussions master Synced yesterday

READMEChangelog (5)Dependencies (18)Versions (8)Used By (0)

Filament Captcha
================

[](#filament-captcha)

[![Latest Version](https://camo.githubusercontent.com/0281dd1311ae5fcca9392cd59a31eca8befbaf3aabeabcaad7b1d10fbf6e5e67/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6464722f66696c616d656e742d636170746368612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ddr/filament-captcha)[![Total Downloads](https://camo.githubusercontent.com/15f8e3df8e4a13be510d0a673be30d2a67f1d99df1f31ad2ad72cbfc14dd2e68/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6464722f66696c616d656e742d636170746368612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ddr/filament-captcha)[![GitHub Tests Action Status](https://camo.githubusercontent.com/ae4aff715ffb94fe491e66ef3517db04d5ae1047a2d4c0f75323b52bdde5cb74/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f64616e6965316e6574302f66696c616d656e742d636170746368612f74657374732e796d6c3f6272616e63683d6d6173746572266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/danie1net0/filament-captcha/actions?query=workflow%3Atests+branch%3Amaster)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/9918d02519a7f6c2020d8fc74de4f699e59d717c8f20738716ee3ec0e667ffcb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f64616e6965316e6574302f66696c616d656e742d636170746368612f636f64652d7374796c652e796d6c3f6272616e63683d6d6173746572266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/danie1net0/filament-captcha/actions?query=workflow%3A%22code-style%22+branch%3Amaster)[![License](https://camo.githubusercontent.com/faa0e85f019ce6952a4b452f3edc2ff8969c8a5aedf7b97bd4ea9d436892657a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f64616e6965316e6574302f66696c616d656e742d636170746368612e7376673f7374796c653d666c61742d737175617265)](https://github.com/danie1net0/filament-captcha/blob/master/LICENSE)

Multi-provider captcha integration for Filament forms, supporting hCaptcha, reCAPTCHA v2, reCAPTCHA v3, and Cloudflare Turnstile.

Features
--------

[](#features)

- 🔒 Multiple captcha providers (hCaptcha, reCAPTCHA v2, reCAPTCHA v3, Turnstile)
- 🎨 Seamless integration with Filament forms
- ⚙️ Driver-based architecture for easy extension
- 🧪 Comprehensive test coverage
- 📦 Compatible with Filament v3, v4 and v5
- 🔧 Development mode support

Requirements
------------

[](#requirements)

- PHP ^8.2
- Laravel 11, 12 or 13
- Filament 3, 4 or 5

Installation
------------

[](#installation)

```
composer require ddr/filament-captcha
```

Publish the configuration file (optional):

```
php artisan vendor:publish --tag="captcha-config"
```

Configuration
-------------

[](#configuration)

Add the following environment variables to your `.env` file based on your chosen provider:

### hCaptcha

[](#hcaptcha)

```
CAPTCHA_DRIVER=hcaptcha
HCAPTCHA_SITEKEY=your-site-key
HCAPTCHA_SECRET=your-secret-key
```

Get your keys at [hCaptcha Dashboard](https://dashboard.hcaptcha.com/).

### Google reCAPTCHA v2

[](#google-recaptcha-v2)

```
CAPTCHA_DRIVER=recaptcha_v2
RECAPTCHA_V2_SITEKEY=your-site-key
RECAPTCHA_V2_SECRET=your-secret-key
```

Get your keys at [Google reCAPTCHA Admin Console](https://www.google.com/recaptcha/admin).

### Google reCAPTCHA v3

[](#google-recaptcha-v3)

```
CAPTCHA_DRIVER=recaptcha_v3
RECAPTCHA_V3_SITEKEY=your-site-key
RECAPTCHA_V3_SECRET=your-secret-key
RECAPTCHA_V3_SCORE=0.5
```

Get your keys at [Google reCAPTCHA Admin Console](https://www.google.com/recaptcha/admin).

The `RECAPTCHA_V3_SCORE` determines the minimum score required to pass validation (0.0 - 1.0, default: 0.5).

### Cloudflare Turnstile

[](#cloudflare-turnstile)

```
CAPTCHA_DRIVER=turnstile
TURNSTILE_SITEKEY=your-site-key
TURNSTILE_SECRET=your-secret-key
```

Get your keys at [Cloudflare Turnstile Dashboard](https://dash.cloudflare.com/?to=/:account/turnstile).

Usage
-----

[](#usage)

### In Filament Forms

[](#in-filament-forms)

```
use Ddr\FilamentCaptcha\Forms\Components\Captcha;

public function form(Form $form): Form
{
    return $form
        ->schema([
            // ... other fields
            Captcha::make('captcha'),
        ]);
}
```

### Specifying a Driver

[](#specifying-a-driver)

You can override the default driver:

```
Captcha::make('captcha')->driver('recaptcha_v2')
```

### Custom Login Page

[](#custom-login-page)

Create a custom login page extending Filament's base login:

```
