PHP code example of fsorge / cloudflare-turnstile-php

1. Go to this page and download the library: Download fsorge/cloudflare-turnstile-php 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/ */

    

fsorge / cloudflare-turnstile-php example snippets


use Fsorge\Cloudflare\Turnstile;

$turnstile = new Turnstile('YOUR_SECRET_KEY');

$isCaptchaValid = $turnstile->isValid('RESPONSE_FROM_CLIENT');

use Fsorge\Cloudflare\Turnstile;

$turnstile = new Turnstile('0x......');

$isCaptchaValid = $turnstile->isValid('0.id8uAhu.....');

if ($isCaptchaValid) {
    // Captcha has been validated
} else {
    // Captcha NOT validate
}
shell
composer