tonyaxo/yii2-recaptcha

Yii2 Google reCaptcha implementation

Installs: 1 770

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 0

Type:yii2-extension

1.0 2018-08-07 09:07 UTC

This package is not auto-updated.

Last update: 2024-11-16 04:27:46 UTC


README

Yii2 Google reCAPTCHA version 2.0 implementation.

Total Downloads

Overview

ReCaptcha API version 2.0 docs.

Features

  • All reCAPTCHA API 2.0 features;
  • Multiple support;
  • Ajax (Pjax) support;
  • jQuery not require;

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist tonyaxo/yii2-recaptcha "~1.0"

or add

"tonyaxo/yii2-recaptcha": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

'components' => [
    'recaptcha' => [
        'class' => 'recaptcha\ReCaptchaComponent',
        'siteKey' => 'site_key',
        'secretKey' => 'key_secret',
    ],
];

You can also use this widget in an [[yii\widgets\ActiveForm|ActiveForm]] using the [[yii\widgets\ActiveField::widget()|widget()]] method, for example like this:

<?= $form->field($model, 'reCaptcha')->widget(ReCaptcha::class, [
    'id' => 'sign-up-captcha',
    'render' => ReCaptcha::RENDER_EXPLICIT,
])->label(false) ?>