php-captcha/captcha

php image captcha

Installs: 84

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:project

pkg:composer/php-captcha/captcha

1.0 2017-03-22 08:18 UTC

This package is not auto-updated.

Last update: 2025-10-04 01:15:59 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;