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.0.1(4mo ago)3814—6.3%MITPHPPHP ^8.2CI passing

Since Dec 23Pushed 4mo 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 1mo ago

READMEChangelog (2)Dependencies (9)Versions (5)Used By (0)

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

[](#filament-captcha)

[![Latest Version](https://camo.githubusercontent.com/55d2a86c33d42a8b5cfea88108cc11268866f9a14b6017cd04a9d1b327a6efb3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64616e6965316e6574302f66696c616d656e742d636170746368612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/danie1net0/filament-captcha)[![Total Downloads](https://camo.githubusercontent.com/fe9a0839cf9d1aa2f007fcfc266e28671ca0d9888f0a6ba9167536db59b8d48e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64616e6965316e6574302f66696c616d656e742d636170746368612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/danie1net0/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 and v4
- 🔧 Development mode support

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:

```
