vincenzoraco / turnstile-for-laravel
Laravel package to facilitate the server side validation of Cloudflare's Turnstile captcha service.
Package info
github.com/vincenzoraco/turnstile-for-laravel
pkg:composer/vincenzoraco/turnstile-for-laravel
v2.0.0
2026-04-16 04:09 UTC
Requires
- php: ^8.3
- illuminate/support: ^11.0|^12.0
- vincenzoraco/turnstile-php: ^2.0
Requires (Dev)
- laravel/framework: ^12.0
- laravel/pint: ^1.0
- orchestra/canvas: ^10.0
- orchestra/testbench: ^10.0
- pestphp/pest: ^3.7 || ^4.0
- phpstan/phpstan: ^2.1
- rector/rector: ^2.0
This package is auto-updated.
Last update: 2026-04-16 04:10:39 UTC
README
A package to facilitate the server side validation of Cloudflare's Turnstile captcha service.
Note
This package requires PHP 8.3+ and Laravel 11+
Installation
You can install the package via composer:
composer require vincenzoraco/turnstile-for-laravel
Usage
Once installed, set the following ENV:
TURNSTILE_SECRET_KEY=
TURNSTILE_SITE_KEY=
Then publish the config file:
php artisan vendor:publish --tag=turnstile-config
Note
TURNSTILE_SITE_KEY is only for your convenience to have it in the config
You can then use the validation rule:
use VincenzoRaco\TurnstileLaravel\Rules\TurnstileCheck; $request->validate([ 'cf-turnstile-response' => ['required', new TurnstileCheck], ]);
Or use the facade directly:
use VincenzoRaco\Turnstile\DataObjects\TurnstileValidateDTO; use VincenzoRaco\TurnstileLaravel\Facades\Turnstile; $result = Turnstile::validate(new TurnstileValidateDTO( $token, )); if ($result->isFailure()) { throw new CaptchaException; // custom exception }