vintage / yii2-invisible-recaptcha
Facade of Invisible reCAPTCHA by Google for Yii2 Framework
Installs: 38 563
Dependents: 3
Suggesters: 0
Security: 0
Stars: 3
Watchers: 3
Forks: 1
Type:yii2-extension
Requires
- yiisoft/yii2: ^2.0.0
- yiisoft/yii2-httpclient: ~2.0.0
Requires (Dev)
This package is not auto-updated.
Last update: 2024-10-27 06:02:33 UTC
README
Invisible reCAPTCHA
Facade of Invisible reCAPTCHA by Google for Yii2 Framework. For more info read official documentation.
Installation
Install package
Run command
$ composer require vintage/yii2-invisible-recaptcha
or add
"vintage/yii2-invisible-recaptcha": "~1.0"
to the require section of your composer.json.
Usage
-
Creates API key in your Google Account
-
Configure API keys in
frontend/config/params-local.php
<?php use vintage\recaptcha\helpers\RecaptchaConfig; return [ RecaptchaConfig::SITE_KEY => 'your_site_key', RecaptchaConfig::PRIVATE_KEY => 'your_private_key', ];
- Call widget in form
<form id="send-feedbacl-js" method="post">
<?= \vintage\recaptcha\widgets\InvisibleRecaptcha::widget([ 'formSelector' => '#send-feedback-js', ]) ?>
<button type="submit">Send</button> </form>
- Validate in backend
\vintage\recaptcha\validators\InvisibleRecaptchaValidator::validateInline( Yii::$app->getRequest()->post() );
or if you want to handle the errors
$validator = new \vintage\recaptcha\validators\InvisibleRecaptchaValidator( Yii::$app->getRequest()->post() ); if (!$validator->validate()) { return $validator->getErrors(); }
Configuration
Widget configuration options.
License
This project is released under the terms of the BSD-3-Clause license.
Copyright (c) 2017, Vintage Web Production