PHP code example of daycry / recaptcha

1. Go to this page and download the library: Download daycry/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/ */

    

daycry / recaptcha example snippets


$psr4 = [
    'Config'      => APPPATH . 'Config',
    APP_NAMESPACE => APPPATH,
    'App'         => APPPATH,
    'Daycry\ReCaptcha' => APPPATH .'ThirdParty/recaptcha/src',
];


public $ruleSets = [
    ...
    \Daycry\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();

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

public $functions_safe = [ 'form_hidden', 'form_open', 'form_close', 'csrf_token', 'csrf_hash', 'url_title', 'reCaptcha3' ];

{{ reCaptcha3( 'reCaptcha', {'id' : 'recaptcha_v3'}, {'action' : 'signup'} ) | raw }}

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