PHP code example of dubashi / simple-captcha-php
1. Go to this page and download the library: Download dubashi/simple-captcha-php library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
dubashi / simple-captcha-php example snippets
use Dubashi\SimpleCaptcha;
// create your own code
$code = '0123';
// Output http-response with captcha image
(new SimpleCaptcha())->create( $code )->output();
use Dubashi\SimpleCaptcha;
// create your own code
$code = '0123';
// Create animated GIF captcha and save it into file
$captcha = (new SimpleCaptcha([
'type' => \IMAGETYPE_GIF,
'thickness' => 5,
]))
->create( $code ) // create captcha with "code"
->split( 3 ) // split into 3 parts/frames
->outputFile('captcha') // save into file "captcha.gif"
;
// ..and get base64 data of image for own usage
$dataBase64 = $captcha->dataUri();
// ..or just output <img> tag into yours html-templaters
$captcha->outputImgHtml();
bash
composer