PHPackages                             zemasterkrom/zmkr-cloudflare-turnstile-bundle - 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. [Security](/categories/security)
4. /
5. zemasterkrom/zmkr-cloudflare-turnstile-bundle

ActiveSymfony-bundle[Security](/categories/security)

zemasterkrom/zmkr-cloudflare-turnstile-bundle
=============================================

Extensible and configurable integration of Cloudflare Turnstile with Symfony

v2.0(2mo ago)86.8k↓26.2%1[1 issues](https://github.com/Zemasterkrom/zmkr-cloudflare-turnstile-bundle/issues)MITPHPPHP &gt;=8.2CI passing

Since Jan 13Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/Zemasterkrom/zmkr-cloudflare-turnstile-bundle)[ Packagist](https://packagist.org/packages/zemasterkrom/zmkr-cloudflare-turnstile-bundle)[ RSS](/packages/zemasterkrom-zmkr-cloudflare-turnstile-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (24)Versions (12)Used By (0)

ZmkrCloudflareTurnstileBundle
=============================

[](#zmkrcloudflareturnstilebundle)

[![CI Status](https://github.com/zemasterkrom/zmkr-cloudflare-turnstile-bundle/actions/workflows/ci.yaml/badge.svg)](https://github.com/zemasterkrom/zmkr-cloudflare-turnstile-bundle/actions)[![codecov](https://camo.githubusercontent.com/f583fc63267b1ef753b33d845db7071acce9b210e2da7706819fecc4204f39d8/68747470733a2f2f636f6465636f762e696f2f67682f7a656d61737465726b726f6d2f7a6d6b722d636c6f7564666c6172652d7475726e7374696c652d62756e646c652f67726170682f62616467652e737667)](https://codecov.io/gh/Zemasterkrom/zmkr-cloudflare-turnstile-bundle/)

Requires **Symfony `>= 5.4`** and **PHP `>= 8.2`**. Tested up to **Symfony 8**.

The purpose of this bundle is to facilitate the configuration and integration of the **Cloudflare Turnstile** captcha system into **Symfony** forms.

Summary of features provided:

- Automatic captcha rendering, language configuration and validation
- Timeout management
- Client-side error domain management
- reCAPTCHA / hCaptcha compatibility mode
- Possibility of using custom JavaScript rendering logic
- Possibility of marking captchas as required

Get started
-----------

[](#get-started)

### With Symfony Flex

[](#with-symfony-flex)

Run the following command with **Composer**:

`composer require zemasterkrom/zmkr-cloudflare-turnstile-bundle`

If you have not explicitly allowed "contrib" recipes in your *composer.json* file, you will be prompted with the following message for `zemasterkrom/zmkr-cloudflare-turnstile-bundle`:

> Do you want to execute this recipe?

Answer **yes** for `zemasterkrom/zmkr-cloudflare-turnstile-bundle`.

Finally, modify the `zemasterkrom/zmkr-cloudflare-turnstile-bundle` section of the `.env` file to add your **Cloudflare Turnstile** application keys:

```
###> zemasterkrom/zmkr-cloudflare-turnstile-bundle ###
CLOUDFLARE_TURNSTILE_SITEKEY=
CLOUDFLARE_TURNSTILE_SECRET_KEY=
###< zemasterkrom/zmkr-cloudflare-turnstile-bundle ###

```

### Without Symfony Flex

[](#without-symfony-flex)

Install **Composer** dependencies:

`composer require zemasterkrom/zmkr-cloudflare-turnstile-bundle`

Register the bundle inside the `config/bundles.php` file:

```
return [
    //...
    Zemasterkrom\CloudflareTurnstileBundle\ZmkrCloudflareTurnstileBundle::class => ['all' => true],
];
```

Create the `config/packages/zmkr_cloudflare_turnstile.yaml` configuration file:

```
zmkr_cloudflare_turnstile:
    captcha:
        sitekey: "%env(CLOUDFLARE_TURNSTILE_SITEKEY)%"
        secret_key: "%env(CLOUDFLARE_TURNSTILE_SECRET_KEY)%"
```

Add your **Cloudflare Turnstile** application keys to the `.env` file:

```
CLOUDFLARE_TURNSTILE_SITEKEY=
CLOUDFLARE_TURNSTILE_SECRET_KEY=

```

Usage
-----

[](#usage)

To add a **Cloudflare Turnstile** captcha to a form, you need to associate a `CloudflareTurnstileType` field in your form builder:

```
