PHP code example of larva / laravel-captcha

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

    

larva / laravel-captcha example snippets


$validatedData = $request->validate([
    'captcha' => '

use Larva\Captcha\Captcha;

if (Captcha::validate($request->input('captcha'), false)) {
    // 验证通过
}

use Larva\Captcha\Captcha;

Captcha::setFixedVerifyCode('test-code');
bash
# 发布配置文件到 config/captcha.php
php artisan vendor:publish --tag=captcha-config

# 发布字体文件到 resources/fonts/
php artisan vendor:publish --tag=captcha-fonts