Download the PHP package danieledesantis/laravel-cloudflare-turnstile-react-blade without Composer

On this page you can find all versions of the php package danieledesantis/laravel-cloudflare-turnstile-react-blade. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-cloudflare-turnstile-react-blade

Laravel Cloudflare Turnstile for React and Blade

Latest Version on Packagist Total Downloads

Cloudflare Turnstile integration for Laravel with built-in support for Blade, React, and Inertia.js. Protect your Laravel applications from bots and abuse with Cloudflare's free CAPTCHA alternative.

Quickstart

Read the Quick Start Guide to get up and running in 5 minutes.

Features

Requirements

Installation

Step 1: Install via Composer

Step 2: Publish Configuration

Step 3: Publish Components

Publish React/TypeScript Components (for React/Inertia.js projects)

If you are using React or Inertia.js, publish the TypeScript components:

This will publish the components to resources/js/Components/Turnstile/:

You can then import them directly in your code:

Publish Blade Components (for Blade projects)

If you are using the Blade templating engine, publish the component:

This will publish the component to resources/views/vendor/turnstile/components/turnstile-widget.blade.php.

You can now use it in your code:

Step 4: Configure Environment Variables

Add your Cloudflare Turnstile credentials to your .env file:

Get your keys from Cloudflare Dashboard.

  1. Go to Cloudflare Dashboard
  2. Navigate to Turnstile in the sidebar
  3. Click Add Site
  4. Enter your domain name
  5. Choose widget mode (recommended: Managed)
  6. Copy your Site Key and Secret Key

Usage

Step 1: Add Laravel Validation

You can add Laravel validation for the Cloudflare Turnstile response using one of the following methods:

Using the Validation Rule

Using the Facade

Middleware

Protect entire routes or route groups:

Step 2: Add Cloudflare Turnstile widget to the frontend

React / Inertia.js

Publish the React components using

Pass the sitekey to your component

Add the widget to you form using one of the following methods:

Using the React Component
Using the React Hook
TypeScript Types

The package includes full TypeScript support:

Blade Components

Publish the Blade components using

Add the component to your forms:

Customizing the Widget

Available options:

Configuration

The configuration file config/turnstile.php provides extensive customization:

Testing

The package automatically bypasses Turnstile verification when APP_ENV=testing or TURNSTILE_TESTING=true.

In Your Tests

Running Package Tests

Advanced Usage

Programmatic Verification

IP Whitelisting

Skip verification for trusted IPs (useful for local development):

Or in config/turnstile.php:

Custom Error Messages

Customize error messages in config/turnstile.php:

Controller Example (Complete)

Form Request Example

Troubleshooting

Widget Not Displaying

  1. Check that your site key is correct in .env
  2. Verify the script is loading: check browser console for errors
  3. Ensure you are not blocking Cloudflare domains

Verification Always Fails

  1. Check your secret key is correct
  2. Verify the token field name matches (default: cf-turnstile-response)
  3. Check server can reach Cloudflare's API
  4. Review error logs for detailed error codes

Testing Issues

Make sure TURNSTILE_TESTING=true or APP_ENV=testing is set in your test environment.

Error Codes

Cloudflare Turnstile may return the following error codes:

Security

If you discover any security-related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Support

For support, please open an issue on GitHub or contact [email protected].

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.


Developed by Daniele De Santis


All versions of laravel-cloudflare-turnstile-react-blade with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1|^8.2|^8.3
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/http Version ^10.0|^11.0|^12.0
guzzlehttp/guzzle Version ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package danieledesantis/laravel-cloudflare-turnstile-react-blade contains the following files

Loading the files please wait ...