Search by

yes-corpo / cloudflare-turnstile-bundle

yes-corpo

Package info

github.com/yes-corpo/cloudflare-turnstile-bundle

Type:symfony-bundle

pkg:composer/yes-corpo/cloudflare-turnstile-bundle

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.1.0 2026-10-25 21:57 UTC

This package is auto-updated.

Last update: 2026-10-25 22:19:37 UTC


README

Protects Symfony forms with Cloudflare Turnstile: a TurnstileType form type renders the widget, and a Turnstile constraint verifies the token with Cloudflare when the form is submitted.

Symfony PHP
6.4 8.1+
7.4 8.2+
8.x 8.4+

Installation

composer require yes-corpo/cloudflare-turnstile-bundle

Without Symfony Flex, enable the bundle in config/bundles.php:

YesCorpo\Bundle\CloudflareTurnstileBundle\CloudflareTurnstileBundle::class => ['all' => true],

Configuration

# config/packages/cloudflare_turnstile.yaml
cloudflare_turnstile:
    site_key: '%env(TURNSTILE_SITE_KEY)%'
    secret_key: '%env(TURNSTILE_SECRET_KEY)%'

In development and tests, use the Cloudflare test keys.

Usage

use YesCorpo\Bundle\CloudflareTurnstileBundle\Form\Type\TurnstileType;

$builder->add('captcha', TurnstileType::class);

The form theme is registered automatically: {{ form_widget(form.captcha) }} renders the widget. The error is displayed by {{ form_errors(form) }}, see error bubbling.

Documentation

  • Usage: form options, error messages, translations, how the verification works.
  • Trolls: optional humorous fake CAPTCHAs shown before the real challenge.

Development

composer install
composer test