Download the PHP package mortogo321/laravel-cloudflare-turnstile without Composer

On this page you can find all versions of the php package mortogo321/laravel-cloudflare-turnstile. 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

Laravel Cloudflare Turnstile

Latest Version on Packagist Total Downloads GitHub License PHP Version

A Laravel wrapper package for Cloudflare Turnstile with invisible mode by default, automatic submit button disabling until verification is complete, and refresh button on failure.

Features

Installation

Install the package via Composer:

Publish the configuration file:

Optionally, publish the views if you want to customize them:

Configuration

Add your Cloudflare Turnstile keys to your .env file:

Get your Turnstile keys from: https://dash.cloudflare.com/?to=/:account/turnstile

Configuration Options

The package provides several configuration options in config/turnstile.php:

Usage

Basic Usage in Blade Views

Add the Turnstile widget to your form:

Controller Validation

Option 1: Using the Validation Rule Class (Recommended)

Option 2: Using the String Validation Rule

Option 3: Manual Verification with Facade

Option 4: Manual Verification with Service

Customizing the Widget

You can customize the widget behavior using component attributes:

Custom Submit Button Selector

By default, the package looks for buttons with the data-turnstile-button attribute. You can customize this:

Displaying Validation Errors

Display validation errors in your Blade views:

How It Works

  1. Widget Loading: The Turnstile widget loads in invisible mode (execute appearance)
  2. Button Disabling: Submit buttons with data-turnstile-button attribute are automatically disabled
  3. Verification: Turnstile runs automatically when the form is ready
  4. Button Enabling: Once verification succeeds, submit buttons are re-enabled
  5. Refresh on Failure: If verification fails or times out, a refresh button appears
  6. Form Submission: The form submits with the cf-turnstile-response token
  7. Server Validation: Your controller validates the token with Cloudflare

API Reference

TurnstileService Methods

Verification Response

The verify() method returns an array with the following structure:

Testing

For testing purposes, you can use Cloudflare's test keys:

Troubleshooting

Submit button remains disabled

Verification fails in controller

Widget doesn't appear

Security

License

MIT License

Credits

Support

For issues, questions, or contributions, please visit the GitHub repository.


All versions of laravel-cloudflare-turnstile with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^10.0|^11.0
illuminate/validation Version ^10.0|^11.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 mortogo321/laravel-cloudflare-turnstile contains the following files

Loading the files please wait ...