PHP code example of sooluh / codeigniter4-recaptcha

1. Go to this page and download the library: Download sooluh/codeigniter4-recaptcha library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sooluh / codeigniter4-recaptcha example snippets


public $ruleSets = [
    ...
    \ReCaptcha\Validation\ReCaptchaRules::class
];

helper(['form', 'reCaptcha']);

echo form_open();

echo reCaptcha2('reCaptcha2', ['id' => 'recaptcha_v2'], ['theme' => 'dark']);

echo form_submit('submit', 'Submit');

echo form_close();

helper(['form', 'reCaptcha']);

echo form_open();

echo reCaptcha3('reCaptcha3', ['id' => 'recaptcha_v3'], ['action' => 'contactForm']);

echo form_submit('submit', 'Submit');

echo form_close();

public $validationRules = [
    'reCaptcha2' => 'Form,0.9]'
    ....
];