riskivy/yii2-rest-api-captcha

The captcha image generator for restful api

2.1.4 2018-09-11 03:49 UTC

This package is not auto-updated.

Last update: 2025-01-08 22:43:06 UTC


README

Simple captcha image generator for restful api 22

Installation

Recommended installation via composer:

composer require riskivy/yii2-rest-api-captcha

Usage

Generate captcha code (image/png;base64):

(new CaptchaHelper())->generateImage();

Use in HTML:

<img src="<?= (new CaptchaHelper())->generateImage() ?>" />

Verify POST method captcha code:

(new CaptchaHelper())->verify(\Yii::$app->request->post('code'));