PHP code example of dev-3bdulrahman / laravel-captcha
1. Go to this page and download the library: Download dev-3bdulrahman/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/ */
dev-3bdulrahman / laravel-captcha example snippets
use Illuminate\Http\Request;
public function submit(Request $request)
{
$request->validate([
'captcha' => '
// config/captcha.php
'image' => [
'use_svg' => true, // Enable SVG format
// ... other settings
],
use Dev3bdulrahman\LaravelCaptcha\Facades\Captcha;
// Generate captcha
$data = Captcha::generate('image', 'medium');
// Verify captcha
$isValid = Captcha::verify($input, 'image');
// Refresh captcha
Captcha::refresh('image');
// Get captcha data
$data = Captcha::getData('image');
use Dev3bdulrahman\LaravelCaptcha\Facades\Captcha;
if (Captcha::verify($request->input('captcha'), 'image')) {
// Captcha is valid
} else {
// Captcha is invalid
}