PHP code example of wearesho-team / yii2-recaptcha-v3
1. Go to this page and download the library: Download wearesho-team/yii2-recaptcha-v3 library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wearesho-team / yii2-recaptcha-v3 example snippets
use Wearesho\ReCaptcha;
// config.php
return [
'bootstrap' => [
'reCaptcha' => [
'class' => ReCaptcha\V3\Yii2\Bootstrap::class,
'config' => ReCaptcha\V3\EnvironmentConfig::class, // or another config interface implementation
'yiiConfig' => ReCaptcha\V3\Yii2\EnvironmentConfig::class, // will be used for environment checking
],
// another bootstraps
],
];
use yii\base;
use Wearesho\ReCaptcha;
class Model extends base\Model {
/** @var string token for reCAPTCHA verification */
public $token;
public function rules(): array
{
return [
[['token',], '}
use yii\web;
use Wearesho\ReCaptcha;
class Controller extends web\Controller
{
public function behaviors(): array
{
return [
'reCaptcha' => [
'class' => ReCaptcha\V3\Yii2\Behavior::class,
'actions' => [
'login' => ['post',],
],
'min' => 0.5,
'max' => 1,
'hostNames' => ['wearesho.com',],
'environments' => ['prod',],
],
];
}
// controller code
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.