Simple and customizable captcha generation library, runs on PHP >= 5.3.
1.0.1
2017-02-02 02:09 UTC
Requires
- php: ^5.3 || ^7.0
Requires (Dev)
- phpunit/phpunit: ^4.0 || ^5.0
This package is auto-updated.
Last update: 2024-12-07 00:31:14 UTC
README
Simple and customizable captcha generation library, runs on PHP >= 5.3.
Ank:
अंक
(Number)
Install
composer require vaibhavpandeyvpz/ank
Usage
<?php /** * @desc Create an instance of desired captcha generator. Ank\CaptchaGenerator will generate a random captcha code * while Ank\MathCaptchaGenerator will generate basic mathematics calculations for user to solve. */ $captcha = new Ank\CaptchaGenerator(); // or $captcha = new Ank\MathCaptchaGenerator(); // Generate a captcha image and output the image to user-agent header('Content-Type: image/png'); echo $captcha->getCaptcha(); // To verify user input at a later time if ($captcha->isValid($_POST['captcha'])) { // ... captcha is valid } /* * @desc You can also customize look and feel of your image, change font, background or text color and lot more. */ $image = $captcha->getCaptcha() ->setBackgroundColor('#000') ->setForegroundColor('#efefef') ->setFont(Ank\CaptchaImage::FONT_ACME) ->setSize(256, 96) ->setQuality(100); echo $image;
License
See LICENSE.md file. Fonts hand-picked from Google Fonts.