Simple captcha image generator for restful api 22
Recommended installation via composer:
composer require haohetao/yii2-rest-api-captcha
Generate captcha code (image/png;base64):
public function actions()
{
return [
'captcha' => [
'class' => 'haohetao\captcha\CaptchaAction',
'maxLength' => 4,
'minLength' => 4
]
];
}
use in curl(for test):
curl http://localhost/site/captcha
Verify captcha code:
public function rules()
{
return [
[
'code', \haohetao\captcha\CaptchaValidator::class
]
];
}