This package provides a validator for Laravel to validate Cloudflare Turnstile responses. It is useful when you want to validate a reCAPTCHA response from a form.
- PHP 8.3 or higher
- Laravel 11.0 or higher
- Cloudflare Turnstile API key and secret
You can install the package via composer:
composer require versaorigin/cloudflare-turnstile
You can publish the config file with:
php artisan vendor:publish --tag="cloudflare-turnstile-config"
or, you can publish the config file with:
php artisan cloudflare-turnstile:install
This is the contents of the published config file:
return [
'enabled' => env('CLOUDFLARE_TURNSTILE_ENABLED', true),
'key' => env('CLOUDFLARE_TURNSTILE_KEY', 'your-cloudflare-turnstile-key'),
'secret' => env('CLOUDFLARE_TURNSTILE_SECRET', 'your-cloudflare-turnstile-secret'),
];
$request->validate([
'cf-turnstile-response' => 'required|cloudflare_turnstile',
]);
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.