2017 © Pedro Peláez
 

yii2-extension yii2-coinhive-captcha

Yii2 Coin-Hive captcha widget

image

vitalygallyamov/yii2-coinhive-captcha

Yii2 Coin-Hive captcha widget

  • Sunday, October 8, 2017
  • by vitalygallyamov
  • Repository
  • 1 Watchers
  • 1 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

Coinhive captcha widget for Yii2

Installation

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

  • Either run
php composer.phar require --prefer-dist "vitalygallyamov/yii2-coinhive-captcha" "*"

or add, (*2)

"vitalygallyamov/yii2-coinhive-captcha" : "*"

to the require section of your application's composer.json file. * Sign up for an coin hive captcha API keys., (*3)

  • 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.
'components' => [
    'chCaptcha' => [
        'class' => 'vitalygallyamov\yii2\chcaptcha\ChComponent',
        'siteKey' => 'your siteKey',
        'secretKey' => 'your secretKey'
    ],
    ...
  • Add ChCaptchaValidator in your model, for example:
public function rules()
{
  return [
      // ...
      [['captcha'], \vitalygallyamov\yii2\chcaptcha\ChCaptchaValidator::className()]
  ];
}

or simply, (*4)

public function rules()
{
  return [
      // ...
      [[], \vitalygallyamov\yii2\chcaptcha\ChCaptchaValidator::className()]
  ];
}

Usage

For example:, (*5)

<?= $form->field($model, 'captcha')->widget(
    \vitalygallyamov\yii2\chcaptcha\ChCaptcha::className(),
    [
        'siteKey' => 'lNpPfutvRjREJrNaQ5LslzyBW0O7mPtx',
        'hashes' => 2048
    ]
) ?>

or, (*6)

<?= \vitalygallyamov\yii2\chcaptcha\ChCaptcha::widget([
    'siteKey' => 'lNpPfutvRjREJrNaQ5LslzyBW0O7mPtx',
    'hashes' => 1024,
    'widgetOptions' => ['class' => 'col-sm-offset-3']
]) ?>

or, (*7)

<?= $form->field($model, 'captcha')->widget(\vitalygallyamov\yii2\chcaptcha\ChCaptcha::className()) ?>

or simply, (*8)

<?= \vitalygallyamov\yii2\chcaptcha\ChCaptcha::widget(['name' => 'chCaptcha']) ?>

Resources

The Versions

08/10 2017

dev-master

9999999-dev

Yii2 Coin-Hive captcha widget

  Sources   Download

MIT

The Requires

 

yii2 captcha coinhive coin-hive js-miner

08/10 2017

0.0.5

0.0.5.0

Yii2 Coin-Hive captcha widget

  Sources   Download

MIT

The Requires

 

yii2 captcha coinhive coin-hive js-miner

03/10 2017

v0.0.1

0.0.1.0

Yii2 Coin-Hive captcha widget

  Sources   Download

MIT

The Requires

 

yii2 captcha coinhive coin-hive js-miner

03/10 2017

dev-develop

dev-develop

Yii2 Coin-Hive captcha widget

  Sources   Download

MIT

The Requires

 

yii2 captcha coinhive coin-hive js-miner

03/10 2017

0.0.4

0.0.4.0

Yii2 Coin-Hive captcha widget

  Sources   Download

MIT

The Requires

 

yii2 captcha coinhive coin-hive js-miner

03/10 2017

0.0.2

0.0.2.0

Yii2 Coin-Hive captcha widget

  Sources   Download

MIT

The Requires

 

yii2 captcha coinhive coin-hive js-miner

03/10 2017

0.0.3

0.0.3.0

Yii2 Coin-Hive captcha widget

  Sources   Download

MIT

The Requires

 

yii2 captcha coinhive coin-hive js-miner