waldiirawan / captcha-lumen by waldiirawan
forked from Yangbx/captcha-lumen

captcha for lumen
96
0
2
Package Data
Maintainer Username: waldiirawan
Maintainer Contact: waldiirawan127@gmail.com (Vueone)
Package Create Date: 2018-06-05
Package Last Update: 2018-06-06
Language: PHP
License: MIT
Last Refreshed: 2024-11-15 15:12:30
Package Statistics
Total Downloads: 96
Monthly Downloads: 2
Daily Downloads: 0
Total Stars: 0
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

Captcha for Lumen

Captcha for Laravel 5

Preview

Preview

Install

composer require VueOne/captcha-lumen

How to use

    $app->register(VueOne\CaptchaLumen\CaptchaServiceProvider::class);
    class_alias('VueOne\CaptchaLumen\Facades\Captcha','Captcha');

Set

/**
 * captcha set
 */
config(['captcha'=>
    [
        'useful_time' => 5,
        'captcha_characters' => '2346789abcdefghjmnpqrtuxyzABCDEFGHJMNPQRTUXYZ',
        'sensitive' => false,
        'login'   => [
            'length'    => 4,
            'width'     => 120,
            'height'    => 36,
            'angle'     => 10,
            'lines'     => 2,
            'quality'   => 90,
            'invert'    =>false,
            'bgImage'   =>true,
            'bgColor'   =>'#ffffff',
            'fontColors'=>['#339900','#ff3300','#9966ff','#3333ff'],
        ],
    ]
]);

Generate

{Domain}/captchaInfo/{type?}
{
  "captchaUrl": "http://{Domain}/captcha/default/782fdc90-3406-f2a9-9573-444ea3dc4d5c",
  "captchaUuid": "782fdc90-3406-f2a9-9573-444ea3dc4d5c"
}

validate

public function checkCaptcha(Request $request, $type = 'default',$captchaUuid)
{
    $this->validate($request,[
        'captcha'=>'required|captcha:'.$captchaUuid
    ]);
    ...
}

Links