subbee/turnstile-validator
Composer 安装命令:
composer require subbee/turnstile-validator
包简介
Laravel 5.4+ compatible Turnstile validator
README 文档
README
A simple and flexible Laravel package to integrate Cloudflare Turnstile CAPTCHA validation into your applications.
Features
- Easy Turnstile integration
- Validation rule for forms
- Blade directive for widget embedding
- Configurable via
.env - Laravel 5.x, 6.x, 7.x, 8.x, 9.x, 10.x compatible
Installation
composer require subbee/turnstile-validator
Publish configuration (optional):
php artisan vendor:publish --tag=config --provider="TurnstileValidator\TurnstileServiceProvider"
Add .env variables
TURNSTILE_SITEKEY=your-sitekey-here TURNSTILE_SECRET=your-secret-key-here
Getting Cloudflare Turnstile keys
- Go to Cloudflare Turnstile Dashboard.
- Log in or create an account.
- Navigate to Access > Turnstile.
- Click “Add Site”, set the domain and widget mode.
- Copy your Site Key and Secret Key into .env.
Usage
Validation
$request->validate([ 'cf-turnstile-response' => 'required|turnstile', ]);
Blade directive
<form method="POST" action="/submit">
@csrf
@turnstile
<button type="submit">Submit</button>
</form>
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-29