gladyshev / yii2-rucaptcha

CAPTCHAFORUM

Administrator
1656354244343.png
An extension for resolving captcha with Rucaptcha.com. It's just a wrapped gladyshev\rucaptcha-client library.

Rucaptcha API documentation is at official page.


Installation
The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist gladyshev/yii2-rucaptcha

or add

"gladyshev/yii2-rucaptcha": "*"

to the require section of your composer.json file.

Setup
Setup rucaptcha component in your configuration file:
Code:
    ...
    'components' => [
        ...
        'rucaptcha' => [
            'class' => 'gladyshev\yii\rucaptcha\Rucaptcha',
            'apiKey' => getenv('__RUCAPTCHA_KEY__'),
            'options' => [
                'verbose' => (YII_DEBUG === true)
            ]
        ],
        ...
    ],
    ...

Basic Usage
Recognize file or url:

$captchaText = Yii::$app->rucaptcha->recognizeFile('http://example.com/image.jpg');

Documentation https://github.com/gladyshev/yii2-rucaptcha