Skip navigation

Turnstile

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

Option Default Accepts Description
tobimori.dreamform.guards.turnstile.siteKey null `string callback`
tobimori.dreamform.guards.turnstile.secretKey null `string callable`
tobimori.dreamform.guards.turnstile.injectScript true boolean Whether the client-side script should be injected implicitly by the plugin
tobimori.dreamform.guards.turnstile.theme 'auto' `'auto' 'light'