Yii2 Captcha

#1
captchaExtended-math[1].gif

Captcha recognition for all popular services rucaptcha.com , 2captcha.com.

Peculiarities
  • Suitable for all captcha recognition services that work according to common standards
  • Ease of customization
  • Recognition both by the path to the file and by the link
Installation
The preferred way to install this extension is via composer.

Or run

php composer.phar require --prefer-dist jumper423/yii2-captcha "*"

or add

"jumper423/yii2-captchar": "*"

to the file composer.json.

Configuration
Code:
'components' => [

    'captcha' => [

        'class' => 'jumper423\Captcha',

        'pathTmp' => '@app/captcha',

        'apiKey' => '42eab4119020dbc729f657fef270r546',

    ],

],
Usage
Simple example of use:

Code:
$path = 'path/to/captcha.png';

if (\Yii::$app->captcha->run($path)) {

    $captcha = \Yii::$app->captcha->result();

} else {

    throw new Exception(\Yii::$app->captcha->error());

}

It can also be used if you only have a link to a captcha, but for this method you should specify the path in the configuration for saving captchas (pathTmp):



$url = 'https://vk.com/captcha.php?sid=698254154192&s=1';

if (\Yii::$app->captcha->run($url)) {

    $captcha = \Yii::$app->captcha->result();

} else {

    throw new Exception(\Yii::$app->captcha->error());

}
Documentation https://packagist.org/packages/jumper423/yii2-captcha