Download the PHP package derekcodes/turnstile-laravel without Composer
On this page you can find all versions of the php package derekcodes/turnstile-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download derekcodes/turnstile-laravel
More information about derekcodes/turnstile-laravel
Files in derekcodes/turnstile-laravel
Package turnstile-laravel
Short Description A Laravel package to facilitate the server side validation of Cloudflare's Turnstile captcha service.
License MIT
Homepage https://github.com/derekcodes-io/turnstile-laravel
Informations about the package turnstile-laravel
Cloudflare's Turnstile For Laravel
A Laravel package to facilitate the server side validation of Cloudflare's Turnstile captcha service.
Configuration
First you'll need an account Cloudflare and Turnstile setup for your website.
https://developers.cloudflare.com/turnstile/
Installation
Install via composer
Adding your secret key in the .env file
Create a config/turnstile.php
Front-end
Be sure to add the front-end JavaScript from Turnstile: https://developers.cloudflare.com/turnstile/get-started/client-side-rendering/
To save you some time, here's the Turnstile JavaScript necessary for an HTML form. Note that I assume you're using a Blade template, thus the {{ config('turnstile.site_key') }}
.
Usage
Add the use
statement at the top of your file
Initiate the TursileLaravel
object and call the validate
method passing the client response Turnstile's JavaScript provides
Ensure the response is valid
Responses
Example success response
Example error response
Credits
~ Derek Codes
- Website: https://www.derekcodes.io
- Twitter: https://twitter.com/DerekCodes_io
Derek Codes is a comprehensive collection of tutorials on the most popular languages in the industry. You’ll find videos, guides and downloadable assets to help you learn to code PHP, Laravel, JavaScript, CSS and more. Thanks for watching!