PHP code example of lg-xenos / yii2-recaptcha

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

    

lg-xenos / yii2-recaptcha example snippets


'components' => [
    'reCaptcha' => [
        'name' => 'reCaptcha',
        'class' => 'lgxenos\yii2\recaptcha\ReCaptcha',
        // Get reCAPTCHA API keys: https://www.google.com/recaptcha/admin#createsite
        'siteKey' => 'your siteKey',
        'secret' => 'your secret key',
    ],
    ...

public $reCaptcha;

public function rules()
{
  return [
      // ...
      [[], \lgxenos\yii2\recaptcha\ReCaptchaValidator::className(), 'uncheckedMessage' => 'Please confirm that you are not a bot.']
  ];
}

<?= $form->field($model, 'reCaptcha')->widget(\lgxenos\yii2\recaptcha\ReCaptcha::className()) 

<?= $form1->field($modelForm1, 'reCaptcha')
    ->widget(\lgxenos\yii2\recaptcha\ReCaptcha::className(), [
        'widgetOptions' => [
            'id' => 'form-ONE',
        ]
    ])