php-captcha / captcha
php image captcha
Installs: 77
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:project
Requires
- php: >=5.5.0
- predis/predis: ~1.1
This package is not auto-updated.
Last update: 2025-05-02 23:20:06 UTC
README
php image captcha , need GD extension.
require
Predis
install
composer.json
require: {
"php-captcha/captcha": "~1.0"
}
example
-
use base64 string
use Captcha\CaptchaManager $redisClient = ...; $identity = ...; $captcha = new CaptchaManager($redisClient); $base64ImageString = $captcha->createBase64ImageCaptcha($identity); $response = ...; $response->setBody($base64ImageString); return $response;
-
use content-type:image/png
use Captcha\CaptchaManager $redisClient = ...; $identity = ...; $captcha = new CaptchaManager($redisClient); $captcha->createStreamImageCaptcha($identity); $response = ...; $response->headers->add([Content-type' => 'image/png']); return $response;