PHP code example of jumper423 / yii2-captcha

1. Go to this page and download the library: Download jumper423/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/ */

    

jumper423 / yii2-captcha example snippets


'components' => [
    'captcha' => [
        'class' => 'jumper423\Captcha',
        'pathTmp' => '@app/captcha',
        'apiKey' => '42eab4119020dbc729f657fef270r546',
    ],
],

$path = 'path/to/captcha.png';
if (\Yii::$app->captcha->run($path)) {
    $captcha = \Yii::$app->captcha->result();
} else {
    throw new Exception(\Yii::$app->captcha->error());
}

$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());
}

php composer.phar