Skip Navigation
Docs

Turnstile Captcha

DreamForm has built-in support for using Turnstile, a free captcha alternative provided by Cloudflare. It can be embedded into any website, even without sending traffic through Cloudflare.

Adding Turnstile

Follow the CloudFlare documentation on getting a site key & secret key. Proceed by adding the guard and the required keys to your config.php.

// site/config/config.php

return [
  'tobimori.dreamform' => [
    'guards' => [
      'available' => ['turnstile', /* other guards here */ ],
      'turnstile' => [
        'siteKey' => fn () => env('TURNSTILE_SITE_KEY'),
        'secretKey' =>  fn () => env('TURNSTILE_SECRET_KEY')
      ]
    ],
  ],
];

Ideally, you should not commit these keys to your repository, but instead load it from an environment variable, e.g. using the kirby-dotenv plugin by Bruno Meilick, as shown in the example above.

Options

tobimori.dreamform.guards.turnstile. Default Accepts Description
siteKey null string|callback The Turnstile sitekey is used to invoke Turnstile on your site
secretKey null string|callable The Turnstile secret key allows communication between DreamForm and Cloudflare to response
injectScript true boolean Whether the client-side script should be injected implicitly by the plugin
theme 'auto' 'auto'|'light'|'dark' Theme to render the captcha with