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.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package codeigniter4-turnstile

Cloudflare Turnstile for CodeIgniter 4

Build Status Packagist Version License Downloads GitHub stars

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:

  1. Register Fields: In your view file, register the fields where the CAPTCHA should appear:

  2. Create a

    Element: Manually create a
    element in your view with an id matching the fieldName parameter:

  3. Render the CAPTCHA: Finally, render the CAPTCHA by calling turnstile_explicit_render() before the closing tag:

Validation

To validate the CAPTCHA response, you can use the TurnstileRules validation rule in your controller or model.

Adding the Validation Rule

First, register the validation rule in your validation configuration file (app/Config/Validation.php):

Then, in your form validation logic:

Example

Here’s a complete example of using CI4CFTurnstile in a controller:

In your form.php view file:

License

This project is licensed under the MIT License - see the License file for details.

Author

Davod Mozafari - Twitter


All versions of codeigniter4-turnstile with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
codeigniter4/framework Version ^4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package davodm/codeigniter4-turnstile contains the following files

Loading the files please wait ....