2017 © Pedro Peláez
 

yii2-extension yii2-recaptcha-widget

Yii2 Google reCAPTCHA widget

image

mohsen1369/yii2-recaptcha-widget

Yii2 Google reCAPTCHA widget

  • Wednesday, February 14, 2018
  • by mohsen1369
  • Repository
  • 1 Watchers
  • 0 Stars
  • 18 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 77 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

Google reCAPTCHA widget for Yii2

Based on reCaptcha API 2.0., (*1)

Packagist Packagist license, (*2)

Installation

The preferred way to install this extension is through composer., (*3)

  • Either run
php composer.phar require --prefer-dist "himiklab/yii2-recaptcha-widget" "*"

or add, (*4)

"himiklab/yii2-recaptcha-widget" : "*"

to the require section of your application's composer.json file., (*5)

  • Sign up for an reCAPTCHA API keys., (*6)

  • Configure the component in your configuration file (web.php). The parameters siteKey and secret are optional. But if you leave them out you need to set them in every validation rule and every view where you want to use this widget. If a siteKey or secret is set in an individual view or validation rule that would overrule what is set in the config., (*7)

'components' => [
    'reCaptcha' => [
        'name' => 'reCaptcha',
        'class' => 'himiklab\yii2\recaptcha\ReCaptcha',
        'siteKey' => 'your siteKey',
        'secret' => 'your secret key',
    ],
    ...
  • Add ReCaptchaValidator in your model, for example:
public $reCaptcha;

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

or just, (*8)

public function rules()
{
  return [
      // ...
      [[], \himiklab\yii2\recaptcha\ReCaptchaValidator::className(), 'secret' => 'your secret key']
  ];
}

or simply, (*9)

public function rules()
{
  return [
      // ...
      [[], \himiklab\yii2\recaptcha\ReCaptchaValidator::className()]
  ];
}

Usage

For example:, (*10)

<?= $form->field($model, 'reCaptcha')->widget(
    \himiklab\yii2\recaptcha\ReCaptcha::className(),
    ['siteKey' => 'your siteKey']
) ?>

or, (*11)

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

or, (*12)

<?= \himiklab\yii2\recaptcha\ReCaptcha::widget([
    'name' => 'reCaptcha',
    'siteKey' => 'your siteKey',
    'widgetOptions' => ['class' => 'col-sm-offset-3']
]) ?>

or simply, (*13)

<?= \himiklab\yii2\recaptcha\ReCaptcha::widget(['name' => 'reCaptcha']) ?>

Resources

The Versions

14/02 2018

dev-issue_invisible

dev-issue_invisible

Yii2 Google reCAPTCHA widget

  Sources   Download

MIT

The Requires

 

yii2 captcha google widget recaptcha

14/02 2018

dev-master

9999999-dev

Yii2 Google reCAPTCHA widget

  Sources   Download

MIT

The Requires

 

yii2 captcha google widget recaptcha

14/02 2018

v1.1.2

1.1.2.0

Yii2 Google reCAPTCHA widget

  Sources   Download

MIT

The Requires

 

yii2 captcha google widget recaptcha

25/01 2018

1.1.1

1.1.1.0

Yii2 Google reCAPTCHA widget

  Sources   Download

MIT

The Requires

 

yii2 captcha google widget recaptcha

10/01 2018

1.1.0

1.1.0.0

Yii2 Google reCAPTCHA widget

  Sources   Download

MIT

The Requires

 

yii2 captcha google widget recaptcha

08/11 2017

1.0.7

1.0.7.0

Yii2 Google reCAPTCHA widget

  Sources   Download

MIT

The Requires

 

yii2 captcha google widget recaptcha

10/01 2017

1.0.6

1.0.6.0

Yii2 Google reCAPTCHA widget

  Sources   Download

MIT

The Requires

 

The Development Requires

yii2 captcha google widget recaptcha

10/06 2016

1.0.5

1.0.5.0

Yii2 Google reCAPTCHA widget

  Sources   Download

MIT

The Requires

 

The Development Requires

yii2 captcha google widget recaptcha