PHP code example of wtone / lumen-captcha

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

    

wtone / lumen-captcha example snippets


return [
    'default'   => [
        'length'    => 5,
        'width'     => 120,
        'height'    => 36,
        'quality'   => 90,
        'math'      => true, //Enable Math Captcha
    ],
    // ...
];

return [
    'driver' => env('SESSION_DRIVER', 'file'),//默认使用file驱动,你可以在.env中配置
    'lifetime' => 120,//缓存失效时间
    'expire_on_close' => false,
    'encrypt' => false,
    'files' => storage_path('framework/session'),//file缓存保存路径
    'connection' => null,
    'table' => 'sessions',
    'lottery' => [2, 100],
    'cookie' => 'laravel_session',
    'path' => '/',
    'domain' => null,
    'secure' => false,
];

    // regiseter Provider
    $app->register(Illuminate\Session\SessionServiceProvider::class);
    $app->register(Wtone\Captcha\CaptchaServiceProvider::class);
    // load config
    $app->configure('session');
    $app->configure('captcha');
    // set alias
    $app->alias('session', 'Illuminate\Session\SessionManager');
    $app->alias('Captcha', Wtone\Captcha\Facades\Captcha::class);

captcha();

Captcha::create();

captcha_src();

captcha_img();

Captcha::img();

captcha_img('flat');

Captcha::img('inverse');