1. Go to this page and download the library: Download cleup/captcha 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/ */
cleup / captcha example snippets
use Cleup\Package\Captcha\Image;
# Instance of the class
$captcha = new Image([
# Captcha Parameters
'width' => 300,
'height' => 60,
/* You can set a range for these parameters using various methods (rand, random_int) */
// 'length' => 5,
// 'fontSize' => 24,
// 'allowedCharacters' => '1234567890abcdefghijkmnpqrstuvwxyz',
// 'width' => 140,
// 'height' => 60,
// 'maxLines' => 8,
// 'minLines' => 4,
// 'pointColor' => array(77, 77, 77),
// 'textColor' => array(
// rand(0, 78),
// rand(0, 100),
// rand(0, 7)
// )
]);
// Create a captcha image
$captcha->create();
/* The end of the file. */
...
<img src="/image.php" alt="Captcha"/>
// Or
<img src="/captcha/image.php?<?= rand(10, 1000);
use Cleup\Package\Captcha\Verification;
# Instance of the class
$verification = new Verification();
// Raw data
$data = json_decode(
file_get_contents('php://input'),
true
);
// Getting the code
$code = $data['code'] ?? false;
if (!$code) {
$response = [
'success' => false,
'message' => 'You have not entered the ;
echo json_encode($response);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.