PHPackages                             teampanfu/laravel-turnstile - 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. teampanfu/laravel-turnstile

AbandonedArchivedLibrary

teampanfu/laravel-turnstile
===========================

Laravel package for Cloudflare's Turnstile CAPTCHA service

v1.1.0(1y ago)1319↓100%MITPHPPHP ^8.2CI passing

Since Jul 17Pushed 8mo agoCompare

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

READMEChangelog (4)Dependencies (2)Versions (5)Used By (0)

Turnstile for Laravel
=====================

[](#turnstile-for-laravel)

[![Latest Version](https://camo.githubusercontent.com/8324d01e280f1ec9dc0864c7fb6f41c65da013d260dd30ea53fe096fc3b704a9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f7465616d70616e66752f6c61726176656c2d7475726e7374696c652e7376673f7374796c653d666c61742d737175617265)](https://github.com/teampanfu/laravel-turnstile/releases)[![Total Downloads](https://camo.githubusercontent.com/c9215030636a53a92d61c84b298fd3489d0b55f4f16bacdfa37bb0950c291d10/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7465616d70616e66752f6c61726176656c2d7475726e7374696c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/teampanfu/laravel-turnstile)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

A Laravel package that integrates [Cloudflare's Turnstile](https://developers.cloudflare.com/turnstile) CAPTCHA service.

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

[](#requirements)

For Laravel integration:

- PHP 8.2 or higher
- [Laravel](https://laravel.com) 9 or higher

For standalone usage:

- PHP 8.2 or higher
- [Guzzle HTTP](https://docs.guzzlephp.org) 7.8 or higher

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

[](#installation)

```
composer require teampanfu/laravel-turnstile
```

Laravel Integration
-------------------

[](#laravel-integration)

1. Add to your `.env`:

```
TURNSTILE_SITEKEY=1x00000000000000000000AA
TURNSTILE_SECRET=1x0000000000000000000000000000000AA

```

### Add the Widget

[](#add-the-widget)

```

    @csrf

    Submit

```

See [available configurations](https://developers.cloudflare.com/turnstile/get-started/client-side-rendering/#configurations) for theme, language, etc.

### Validate the Response

[](#validate-the-response)

```
$request->validate([
    'cf-turnstile-response' => ['required', 'turnstile'],
]);
```

### Custom Error Message

[](#custom-error-message)

In `lang/[lang]/validation.php`:

```
'custom' => [
    'cf-turnstile-response' => [
        'turnstile' => 'Please verify that you are human.',
    ],
],
```

Standalone Usage
----------------

[](#standalone-usage)

The package can also be used without Laravel:

```
