PHP code example of fab120 / laravel-cloudflare-turnstile
1. Go to this page and download the library: Download fab120/laravel-cloudflare-turnstile library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fab120 / laravel-cloudflare-turnstile example snippets
use Illuminate\Validation\Rule;
use RyanChandler\LaravelCloudflareTurnstile\Rules\Turnstile;
public function submit(Request $request)
{
$request->validate([
'cf-turnstile-response' => ['
use RyanChandler\LaravelCloudflareTurnstile\Facades\Turnstile;
Turnstile::fake(): // Force a successful response.
Turnstile::fake()->fail(); // Force a failed response.
Turnstile::fake()->expired(); // Force an expired token response.