PHP code example of etchfoda / recaptcha

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

    

etchfoda / recaptcha example snippets


{!! app('reCaptcha')->render(); !!}

// or you can use this in blade
@reCaptcha

{!! app('reCaptcha')->render('en'); !!}

// or you can use this in blade
@reCaptcha('en')

$validate = Validator::make(Input::all(), [
    'g-recaptcha-response' => '

$config['composer_autoload'] = TRUE;

$config['reCaptcha.sitekey'] = 'sitekey'; 
$config['reCaptcha.secret'] = 'secretkey';
// optional
$config['reCaptcha.options'] = [
    'hideBadge' => false,
    'dataBadge' => 'bottomright',
    'timeout' => 5,
    'debug' => false
];

$data['reCaptcha'] = new \EtchFoda\InvisibleReCaptcha\InvisibleReCaptcha(
    $this->config->item('reCaptcha.sitekey'),
    $this->config->item('reCaptcha.secret'),
    $this->config->item('reCaptcha.options'),
);

 echo $reCaptcha->render(); 

$reCaptcha->verifyResponse($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']);



Key = 'sitekey';
$secretKey = 'secretkey';
// optional
$options [
    'hideBadge' => false,
    'dataBadge' => 'bottomright',
    'timeout' => 5,
    'debug' => false
];
$reCaptcha = new \EtchFoda\InvisibleReCaptcha\InvisibleReCaptcha($siteKey, $secretKey, $options);

// you can override single option config like this
$reCaptcha->setOption('debug', true);

if (!empty($_POST)) {
    var_dump($reCaptcha->verifyResponse($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']));
    exit();
}