1. Go to this page and download the library: Download njoguamos/laravel-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/ */
njoguamos / laravel-turnstile example snippets
class Kernel extends HttpKernel {
// other class code
protected $routeMiddleware = [
// Other middlewares
'turnstile' => \NjoguAmos\Turnstile\Http\Middleware\TurnstileMiddleware::class
];
}
Route::get('/register', function () {
//
})->middleware('turnstile');
use NjoguAmos\Turnstile\Rules\TurnstileRule;
class RegisterRequest extends FormRequest
{
/** @return array<string, array> */
public function rules(): array
{
return [
# Other fields
'token' => ['
use NjoguAmos\Turnstile\Turnstile;
$isValid = (new Turnstile())->validate($token);
// Code is valid or invalid
bash
php artisan turnstile:install
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.