1. Go to this page and download the library: Download dynamikaweb/yii2-captcha 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/ */
dynamikaweb / yii2-captcha example snippets
use dynamikaweb\captcha\Captcha;
namespace app\models;
use dynamikaweb\captcha\CaptchaValidator;
class SomeModel extends yii\base\Model
{
public $captcha;
public function rules()
{
return [
[['captcha'], CaptchaValidator::classname(),
'type' => CaptchaValidator::TYPE_RECAPTCHA, // or CaptchaValidator::TYPE_HCAPTCHA
'siteKey' => 'XXX', // (optional)
'secret' => 'XXX'
]
];
}
}
use dynamikaweb\captcha\Captcha;
namespace app\models;
use dynamikaweb\captcha\CaptchaValidator;
class SomeModel extends yii\base\Model
{
public $captcha;
public function rules()
{
return [
[['captcha'], CaptchaValidator::classname(),
'type' => CaptchaValidator::TYPE_RECAPTCHA, // or CaptchaValidator::TYPE_HCAPTCHA
'secret' => 'XXX'
]
];
}
}
use dynamikaweb\captcha\Captcha;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.