承接 muazzambuilds/filament-turnstile 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

muazzambuilds/filament-turnstile

Composer 安装命令:

composer require muazzambuilds/filament-turnstile

包简介

Cloudflare Turnstile panel plugin for Filament v5 — register once, auto-protect login (and optionally registration / password reset).

README 文档

README

Cloudflare Turnstile panel plugin for Filament v5. Register it once on a panel and login is protected automatically — optionally registration and password-reset request too. No form schema edits for the common case.

Requirements

Dependency Version
PHP ^8.2
Laravel ^11 / ^12
Filament ^5.0

Installation

composer require muazzambuilds/filament-turnstile

Publish the config (optional):

php artisan vendor:publish --tag=filament-turnstile-config

Add your keys to .env:

TURNSTILE_SITE_KEY=your-site-key
TURNSTILE_SECRET_KEY=your-secret-key

Create a widget and get keys at dash.cloudflare.comTurnstile.

Usage

Panel plugin (recommended)

Call ->plugin(...) after ->login() / ->registration() / ->passwordReset() so the plugin can swap the auth page classes:

use MuazzamBuilds\FilamentTurnstile\TurnstilePlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->login()
        ->registration()
        ->passwordReset()
        ->plugin(
            TurnstilePlugin::make()
                ->protectRegistration()   // opt-in
                ->protectPasswordReset()  // opt-in (request page only)
        );
}

Defaults: login is protected; registration and password-reset request are not.

Widget options

TurnstilePlugin::make()
    ->theme('auto')      // auto | light | dark
    ->size('flexible')   // normal | flexible | compact
    ->language('en-US')
    ->enabled(true);

Manual form field

For custom auth pages or any Filament form:

use MuazzamBuilds\FilamentTurnstile\Forms\Components\Turnstile;

Turnstile::make('cf-turnstile-response')
    ->theme('dark')
    ->size('compact')
    ->turnstileAction('contact');

Disable auto-swap and extend or compose yourself:

->login(CustomLogin::class)
->plugin(TurnstilePlugin::make()->protectLogin(false))

Custom auth pages

Extend the packaged pages or use the trait:

use MuazzamBuilds\FilamentTurnstile\Pages\Auth\Login as TurnstileLogin;

class Login extends TurnstileLogin
{
    //
}

Local / CI testing

Cloudflare test keys (any hostname, including localhost):

Purpose Site key Secret key
Always passes 1x00000000000000000000AA 1x0000000000000000000000000000000AA
Always blocks 2x00000000000000000000AB 2x0000000000000000000000000000000AA

If keys are missing, the widget is hidden and server validation is skipped so local apps without Turnstile still boot.

Configuration

// config/filament-turnstile.php
return [
    'site_key' => env('TURNSTILE_SITE_KEY'),
    'secret_key' => env('TURNSTILE_SECRET_KEY'),
    'verify_url' => env('TURNSTILE_VERIFY_URL', 'https://challenges.cloudflare.com/turnstile/v0/siteverify'),
    'theme' => env('TURNSTILE_THEME', 'auto'),
    'size' => env('TURNSTILE_SIZE', 'flexible'),
    'language' => env('TURNSTILE_LANGUAGE'),
    'reset_event' => env('TURNSTILE_RESET_EVENT', 'turnstile-reset'),
];

Publish views

php artisan vendor:publish --tag=filament-turnstile-views

Testing this package

composer install
composer test

License

MIT — see LICENSE.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固