PHP code example of mrpunyapal / nativephp-plugin-turnstile

1. Go to this page and download the library: Download mrpunyapal/nativephp-plugin-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/ */

    

mrpunyapal / nativephp-plugin-turnstile example snippets


use MrPunyapal\Turnstile\TurnstileWidget;

$html = app(TurnstileWidget::class)->html([
    'action' => 'signup',
    'size' => 'compact',
]);

use Illuminate\Http\Request;
use MrPunyapal\Turnstile\Facades\Turnstile;

public function store(Request $request)
{
    $data = $request->validate([
        'turnstile_token' => ['sult->isValidFor(
            action: 'signup',
        ),
        422,
        'Turnstile verification failed.',
    );

    // Protected operation...
}