PHP code example of vintage / yii2-invisible-recaptcha

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

    

vintage / yii2-invisible-recaptcha example snippets




use vintage\recaptcha\helpers\RecaptchaConfig;

return [
    RecaptchaConfig::SITE_KEY => 'your_site_key',
    RecaptchaConfig::PRIVATE_KEY => 'your_private_key',
];

<?= \vintage\recaptcha\widgets\InvisibleRecaptcha::widget([
    'formSelector' => '#send-feedback-js',
]) 

\vintage\recaptcha\validators\InvisibleRecaptchaValidator::validateInline(
    Yii::$app->getRequest()->post()
);

$validator = new \vintage\recaptcha\validators\InvisibleRecaptchaValidator(
    Yii::$app->getRequest()->post()
);
if (!$validator->validate()) {
    return $validator->getErrors();
}