PHP code example of ms41 / laravel-captcha13

1. Go to this page and download the library: Download ms41/laravel-captcha13 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/ */

    

ms41 / laravel-captcha13 example snippets


 use Illuminate\Http\Request;
 use Shahid\Captcha\Facades\Captcha;

 public function submit(Request $request)
{
    $request->validate([
        'captcha' => [' ->withInput();
    }

    return back()->with('success', 'Captcha verified successfully!');
}

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Shahid\Captcha\Facades\Captcha;

Route::get('/captcha-test', function () {
    return view('captcha-test');
});

Route::post('/captcha-test', function (Request $request) {
    $request->validate([
        'captcha' => ['

use Shahid\Captcha\Facades\Captcha;

Captcha::validate($request->captcha);



return [
    'length' => 6,
    'width' => 200,
    'height' => 60,
    'background' => '#f9fafb',
    'text_color' => '#374151',
    'session_key' => 'captcha_code',
    'route' => 'captcha/image',
    'font' => null,
];

Route::middleware('web')->group(function () {
    Route::get('captcha/image', [CaptchaController::class, 'image'])
        ->name('captcha13.image');
});
bash
php artisan vendor:publish --tag=captcha13-config