romanzipp/laravel-turnstile
最新稳定版本:1.4.0
Composer 安装命令:
composer require romanzipp/laravel-turnstile
包简介
Cloudflare Turnstile package for Laravel
README 文档
README
Cloudflare Turnstile CAPTCHA package for Laravel.
Installation
composer require romanzipp/laravel-turnstile
Configuration
Copy configuration to project:
php artisan vendor:publish --provider="romanzipp\Turnstile\Providers\TurnstileServiceProvider"
Add environmental variables to your .env:
TURNSTILE_SITE_KEY=
TURNSTILE_SECRET_KEY=
Usage
Laravel Rule
use romanzipp\Turnstile\Rules\TurnstileCaptcha; $payload = $request->validate([ 'cf-turnstile-response' => ['required', 'string', new TurnstileCaptcha()], ]);
Templates
Document head
Injects the script tag. See method signature for more options.
{{ romanzipp\Turnstile\Captcha::getScript() }}
Form
Injects the form element. See method signature for more options.
{{ romanzipp\Turnstile\Captcha::getChallenge() }}
Manual validation (optional)
use romanzipp\Turnstile\Validator; $validator = new Validator(); $response = $validator->validate('input-token'); if ($response->isValid()) { return true; } echo $response->getMessage();
Development
Run Tests
composer test
License
Released under the MIT License.
Authors
统计信息
- 总下载量: 112.79k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 32
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-09-28