afatmustafa/filamentv3-turnstile 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

afatmustafa/filamentv3-turnstile

Composer 安装命令:

composer require afatmustafa/filamentv3-turnstile

包简介

A plugin to help you implement the Cloudflare Turnstile into your Filament panels.

README 文档

README

A plugin to help you implement the Cloudflare Turnstile into your Filament panels.

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Filament V3 Cloudflare Turnstile Integration

This extension leverages Laravel Turnstile under the hood. For more details, please refer to the README on the project page.
Kudos to coderflexx for his remarkable work.

Installation

You can install the package via composer:

composer require afatmustafa/filamentv3-turnstile

Getting Started

To include Cloudflare Turnstile in your app, you'll first need to obtain both the SiteKey and the SecretKey from your Cloudflare dashboard.

Once you have the keys, populate the TURNSTILE_SITE_KEY and TURNSTILE_SECRET_KEY fields in your .env configuration:

TURNSTILE_SITE_KEY=2x00000000000000000000AB
TURNSTILE_SECRET_KEY=2x0000000000000000000000000000000AA


For testing purposes, Cloudflare offers Dummy site keys and secret keys. Consider using them if needed.

TURNSTILE_SITE_KEY=1x00000000000000000000AA
TURNSTILE_SECRET_KEY=1x0000000000000000000000000000000AA

More dummy keys, please refer to the Cloudflare documentation.

Form Component Usage

Now using Turnstile is quite simple, all you need to do is follow the code below:

use Afatmustafa\FilamentTurnstile\Forms\Components\Turnstile;

    Turnstile::make('turnstile')
        ->theme('light') // Supported themes: light, dark
        ->size('normal') // Supported sizes: normal, compact
        ->language('en-US') // Supported languages: ar-eg,de,en,es,fa,fr,id,it,ja,ko,nl,pl,pt-br,ru,tr,uk,zh-cn and zh-tw

Integrating Turnstile Captcha to Filament's Login Page

To seamlessly integrate the Turnstile captcha with the login page in Filament, follow these steps:

  1. Create a new Login class under the app/Filament\Pages\Auth directory, and extend it from the Filament\Pages\Auth\Login class.
    Override the form method, and add the Turnstile component to the form schema.
namespace App\Filament\Pages\Auth;

use Filament\Forms\Form;
use Afatmustafa\FilamentTurnstile\Forms\Components\Turnstile;

class Login extends \Filament\Pages\Auth\Login
{
    public function form(Form $form): Form
    {
        return $form
            ->schema([
                $this->getEmailFormComponent(),
                $this->getPasswordFormComponent(),
                $this->getRememberFormComponent(),
                Turnstile::make('turnstile')
                    ->theme('light')
                    ->size('normal')
                    ->language('en-US'),
            ])
            ->statePath('data');
    }
}


2. In your PanelProvider file, override the login method, and return the newly created Login class.

namespace App\Providers\Filament;

...
use App\Filament\Pages\Auth\Login;
...

class AdminPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            ->default()
            ->id('admin')
            ->path('app')
            ->login(Login::class)
            ...
    }
}


3. That's it! You should now see the Turnstile captcha on the login page. Login Page Demo

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

afatmustafa/filamentv3-turnstile 适用场景与选型建议

afatmustafa/filamentv3-turnstile 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 27.61k 次下载、GitHub Stars 达 14, 最近一次更新时间为 2023 年 08 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「cloudflare」 「filament」 「filament-plugin」 「afatmustafa」 「turnstile」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 afatmustafa/filamentv3-turnstile 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 afatmustafa/filamentv3-turnstile 我们能提供哪些服务?
定制开发 / 二次开发

基于 afatmustafa/filamentv3-turnstile 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 14
  • Watchers: 1
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-12