PHPackages                             mrlks/cloudflare-turnstile-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. mrlks/cloudflare-turnstile-laravel

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

mrlks/cloudflare-turnstile-laravel
==================================

Laravel integration for Cloudflare Turnstile CAPTCHA

v1.0.0(1y ago)02MITPHPPHP ^8.1

Since Nov 21Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mr-lks/cloudflare-turnstile-laravel)[ Packagist](https://packagist.org/packages/mrlks/cloudflare-turnstile-laravel)[ RSS](/packages/mrlks-cloudflare-turnstile-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

Laravel Cloudflare Turnstile
============================

[](#laravel-cloudflare-turnstile)

[![Latest Version on Packagist](https://camo.githubusercontent.com/10687627c0ea60048f7a6ccb51819fb16dc3c6c9edee0696039f30a802d9ba5a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d726c6b732f636c6f7564666c6172652d7475726e7374696c652d6c61726176656c2e737667)](https://packagist.org/packages/mrlks/cloudflare-turnstile-laravel)[![Total Downloads](https://camo.githubusercontent.com/12c4c9e2c97539386d46f36d00824f555b23072371ab439d692669b1e8381ba3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d726c6b732f636c6f7564666c6172652d7475726e7374696c652d6c61726176656c2e737667)](https://packagist.org/packages/mrlks/cloudflare-turnstile-laravel)[![License](https://camo.githubusercontent.com/dcd2295eda438f4c9f675ed65847aa6d618337d197ca9628f44c04bb172e0926/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d726c6b732f636c6f7564666c6172652d7475726e7374696c652d6c61726176656c2e737667)](LICENSE.md)

A Laravel package that provides an elegant way to integrate Cloudflare Turnstile CAPTCHA protection into your Laravel applications. Turnstile is Cloudflare's privacy-first CAPTCHA alternative that helps protect your forms from spam and abuse.

Features
--------

[](#features)

- 🚀 Easy integration with Laravel forms
- 🛡️ Middleware for route protection
- ⚡ Simple validation rules
- 🎨 Customizable widget appearance
- 🔧 Configurable settings

Requirements
------------

[](#requirements)

- PHP ^8.1
- Laravel ^10.0

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require mrlks/cloudflare-turnstile-laravel
```

Configuration
-------------

[](#configuration)

1. Publish the configuration file:

```
php artisan vendor:publish --provider="MrLks\CloudflareTurnstileLaravel\TurnstileServiceProvider"
```

2. Add your Cloudflare Turnstile credentials to your `.env` file:

TURNSTILE\_SITE\_KEY=your-site-key TURNSTILE\_SECRET\_KEY=your-secret-key

Usage
-----

[](#usage)

### Basic Form Integration

[](#basic-form-integration)

1. Add the Turnstile widget to your form:

{!! Turnstile::renderWidget() !!}

2. Validate the Turnstile response in your controller:

use MrLks\\CloudflareTurnstileLaravel\\Rules\\TurnstileRule; public function store(Request $request) { $request-&gt;validate(\[ 'cf-turnstile-response' =&gt; \['required', new TurnstileRule\], \]); // Your logic here }

### Using Middleware

[](#using-middleware)

Protect your routes using the Turnstile middleware:

// In your routes file Route::post('/protected-route', function () { // Your protected route logic })-&gt;middleware('turnstile'); // Or in your controller public function construct() { $this-&gt;middleware('turnstile')-&gt;only(\['store', 'update'\]); }

### Customizing the Widget

[](#customizing-the-widget)

You can customize the widget appearance:

{!! Turnstile::renderWidget(\[ 'data-theme' =&gt; 'dark', 'data-size' =&gt; 'compact', 'data-action' =&gt; 'login', 'data-language' =&gt; 'en' \]) !!}

Available options:

- Theme: `light`, `dark`, `auto`
- Size: `normal`, `compact`
- Language: Any valid language code

Configuration Options
---------------------

[](#configuration-options)

The `config/turnstile.php` file allows you to configure:

return \[ // Your Cloudflare Turnstile keys 'site\_key' =&gt; env('TURNSTILE\_SITE\_KEY', ''), 'secret\_key' =&gt; env('TURNSTILE\_SECRET\_KEY', ''), // Verification endpoint 'verify\_url' =&gt; env('TURNSTILE\_VERIFY\_URL', ''), // Default widget settings 'theme' =&gt; 'light', 'size' =&gt; 'normal', \];

Events
------

[](#events)

The package dispatches the following events:

- `TurnstileValidated`: When a Turnstile challenge is successfully validated
- `TurnstileFailedValidation`: When a Turnstile challenge fails validation

Testing
-------

[](#testing)

composer test

Security
--------

[](#security)

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

Credits
-------

[](#credits)

- [Mrlks](https://github.com/mr-lks)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Support
-------

[](#support)

For support, please use the [issue tracker](https://github.com/yourusername/cloudflare-turnstile-laravel/issues).

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request
    ===================

    [](#open-a-pull-request)

cloudflare-turnstile-laravel
============================

[](#cloudflare-turnstile-laravel)

Laravel integration for Cloudflare Turnstile CAPTCHA

> > > > > > > # 1066a7ad2c02e4c3d3d86e8c7d6fba8efae75106
> > > > > > >
> > > > > > > [](#1066a7ad2c02e4c3d3d86e8c7d6fba8efae75106)

cloudflare-turnstile-laravel
============================

[](#cloudflare-turnstile-laravel-1)

> > > > > > > bc520bb64e4deb9561a07f56826d3bd9a264f47c

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

538d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7d22dd4258a3299099f588d27e2c62b4f6ea9d0989c65e29891aaf6d1b9c2c04?d=identicon)[mr-lks](/maintainers/mr-lks)

---

Top Contributors

[![mr-lks](https://avatars.githubusercontent.com/u/18725747?v=4)](https://github.com/mr-lks "mr-lks (6 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mrlks-cloudflare-turnstile-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/mrlks-cloudflare-turnstile-laravel/health.svg)](https://phpackages.com/packages/mrlks-cloudflare-turnstile-laravel)
```

###  Alternatives

[josiasmontag/laravel-recaptchav3

Recaptcha V3 for Laravel package

2641.6M2](/packages/josiasmontag-laravel-recaptchav3)[rahul900day/laravel-captcha

Different types of Captcha implementation for Laravel Application.

10715.9k](/packages/rahul900day-laravel-captcha)[truckersmp/steam-socialite

Laravel Socialite provider for Steam OpenID.

1516.7k](/packages/truckersmp-steam-socialite)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[pitchanon/facebook-connect

A Laravel package for connecting to the Meta (Facebook) Graph API.

254.3k1](/packages/pitchanon-facebook-connect)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
