Download the PHP package davodm/codeigniter4-turnstile without Composer
On this page you can find all versions of the php package davodm/codeigniter4-turnstile. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download davodm/codeigniter4-turnstile
More information about davodm/codeigniter4-turnstile
Files in davodm/codeigniter4-turnstile
Package codeigniter4-turnstile
Short Description CodeIgniter 4 package for integrating Cloudflare Turnstile Captcha
License
Informations about the package codeigniter4-turnstile
Cloudflare Turnstile for CodeIgniter 4
CI4CFTurnstile is a CodeIgniter 4 library that integrates Cloudflare's Turnstile CAPTCHA for form validation. It supports both implicit and explicit rendering modes.
You can find the document of Cloudflare Turnstile here.
Installation
1. Composer Installation
Install the package via Composer:
2. Configuration
After installation, configure your Cloudflare Turnstile site and secret keys. You can do this by setting the environment variables in your .env file:
Usage
Rendering CAPTCHA
The library provides helper functions turnsitle
to render the CAPTCHA in your views: turnstile_implicit()
, turnstile_explicit()
, and turnstile_explicit_render()
.
Implicit Mode
In your view file, you can render the Turnstile CAPTCHA in implicit mode by calling:
Explicit Mode
For explicit mode, you need to follow these steps:
-
Register Fields: In your view file, register the fields where the CAPTCHA should appear:
-
Create a
Element: Manually create aelement in your view with an id matching the fieldName parameter:- Render the CAPTCHA: Finally, render the CAPTCHA by calling turnstile_explicit_render() before the closing