PHP code example of haohetao / yii2-rest-api-captcha

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

    

haohetao / yii2-rest-api-captcha example snippets


    public function actions()
    {
        return [
            'captcha' => [
                'class' => 'haohetao\captcha\CaptchaAction',
                'maxLength' => 4,
                'minLength' => 4
            ]
        ];
    }

    public function rules()
    {
        return [
            [
                'code', \haohetao\captcha\CaptchaValidator::class
            ]
        ];
    }