baha2odeh / yii2-recaptcha-v3
Yii2 reCAPTCHA v3
Installs: 45 837
Dependents: 1
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 14
Open Issues: 4
Type:yii2-extension
Requires
- yiisoft/yii2: ~2.0.0
This package is auto-updated.
Last update: 2025-02-21 00:50:44 UTC
README
Yii2 reCAPTCHA v3
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist baha2odeh/yii2-recaptcha-v3 "*"
or add
"baha2odeh/yii2-recaptcha-v3": "*"
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your code by :
add this to your components main.php
'components' => [ ... 'recaptchaV3' => [ 'class' => 'Baha2Odeh\RecaptchaV3\RecaptchaV3', 'site_key' => '###', 'secret_key' => '###', 'verify_ssl' => true, // default is true ],
and in your model
acceptance_score the minimum score for this request (0.0 - 1.0) or null
public $code; public function rules(){ return [ ... [['code'], RecaptchaV3Validator::className(), 'acceptance_score' => null] ]; }
<?= $form->field($model,'code')->widget(\Baha2Odeh\RecaptchaV3\RecaptchaV3Widget::className()); ?>