A comprehensive and innovative CAPTCHA library in PHP that supports multiple CAPTCHA types.
- Generate image-based, audio-based, and text-based CAPTCHAs.
- Distinct font variations for CAPTCHA challenges.
- Flexible validation and integration options.
- Examples demonstrating CAPTCHA usage in different scenarios.
Install the CAPTCHA library using Composer:
composer require code-lords/next-captcha
To generate and display an image-based CAPTCHA:
// Include Composer autoloader
require_once 'vendor/autoload.php';
use Codelords\NextCapture\CaptchaGenerator\ImageCaptchaGenerator;
$captchaGenerator = new ImageCaptchaGenerator();
$captchaChallenge = $captchaGenerator->generate();
$captchaImagePath = $captchaGenerator->saveImage('/path/to/save');
// Display $captchaImagePath in your HTML form
To generate an audio-based CAPTCHA:
// Include Composer autoloader
require_once 'vendor/autoload.php';
use Codelords\NextCapture\CaptchaGenerator\AudioCaptchaGenerator;
$captchaGenerator = new AudioCaptchaGenerator();
$captchaChallenge = $captchaGenerator->generate();
// Output $captchaChallenge as an audio element in your HTML
To generate a text-based CAPTCHA:
// Include Composer autoloader
require_once 'vendor/autoload.php';
use Codelords\NextCapture\CaptchaGenerator\TextCaptchaGenerator;
$captchaGenerator = new TextCaptchaGenerator();
$captchaChallenge = $captchaGenerator->generate();
// Display $captchaChallenge in your HTML form
For more detailed usage examples, see the examples directory.
Contributions are welcome! Please read CONTRIBUTING.md for details on how to contribute to this project.
This project is licensed under the MIT License - see the LICENSE file for details.