1. Go to this page and download the library: Download djimmy/laravel-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/ */
use Djimmy\Captcha\CaptchaService;
public function showCaptcha(CaptchaService $captchaService)
{
return $captchaService->generateCaptcha();
}
use Illuminate\Http\Request;
use Djimmy\Captcha\CaptchaService;
public function validateCaptcha(Request $request, CaptchaService $captchaService)
{
$isValid = $captchaService->validateCaptcha($request->input('captcha'));
if ($isValid) {
// CAPTCHA is valid
} else {
// CAPTCHA is invalid
}
}