Download the PHP package dkh/captcha-generator without Composer
On this page you can find all versions of the php package dkh/captcha-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package captcha-generator
PHP Captcha Generator
Description
A PHP library for generating Captcha challenges using libgd.
Captcha examples
- Easy expression captcha:
- Hard expression captcha:
- Easy string captcha:
- Hard string captcha (colored):
Repositories
- GitHub: https://github.com/dangkyokhoang/PHP-Captcha-Generator.
- Packagist: https://packagist.org/packages/dkh/captcha-generator.
Required dependencies
- GD Graphics Library (ext-gd).
User Guide
Installation
You can easily get the library installed on your project by running this command.
Implementation
Captcha types
ExpressionCaptcha
expression captcha requires users to do basic arithmetic operations (addition, subtraction, multiplication and division) to solve.StringCaptcha
string captcha only requires users to recognize the characters in the string.Create a captcha
To create a captcha, use
new *Captcha($size?, $level?)
.
Get captcha's solved value
To get captcha's solved value, call $captcha->solve()
or *Captcha::solveString($string)
.
Store the solved value somewhere, e.g in a session variable, to later verify user's captcha input.
Verify user's captcha input
To verify user's captcha input, compare it with the captcha's previously solved value stored somewhere.
Display the captcha image
To render captcha into image, call $captcha->render($options?)
, Captcha::renderString($string, $options?)
. Return value is a PNG image data string encoded with base64.
To dislay the captcha image, use data URL data:image/png;base64
, or save the rendered image somewhere and return the image's path.
Example implementation of the library
All versions of captcha-generator with dependencies
ext-gd Version *