trueifnotfalse / lumen-captcha by trueifnotfalse
forked from mewebstudio/captcha

Laravel Lumen Captcha Package
22,318
2
0
Package Data
Maintainer Username: trueifnotfalse
Maintainer Contact: me@mewebstudio.com (Muharrem ERİN)
Package Create Date: 2021-07-28
Package Last Update: 2023-06-20
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-04-29 15:01:30
Package Statistics
Total Downloads: 22,318
Monthly Downloads: 871
Daily Downloads: 34
Total Stars: 2
Total Watchers: 0
Total Forks: 2
Total Open Issues: 0

Captcha for Laravel Lumen 8

Preview

Preview

Installation

The Captcha Service Provider can be installed via Composer by requiring the trueifnotfalse/lumen-captcha package.

Require this package with composer:

composer require trueifnotfalse/lumen-captcha

Update your packages with composer update or install with composer install.

Usage

To use the Captcha Service Provider, you must register the provider when bootstrapping your application. There are essentially two ways to do this.

Add to bootstrap/app.php and register the Captcha Service Provider.

    $app->register(TrueIfNotFalse\LumenCaptcha\CaptchaServiceProvider::class);

Configuration

To use your own settings, create config file.

config/captcha.php

return [
    'math' => [
        'length'    => 5,
        'width'     => 120,
        'height'    => 36,
        'quality'   => 90,
        'math'      => true,  //Enable Math Captcha
        'expire'    => 60,    //Stateless/API captcha expiration
    ],
    // ...
];

and enable it in bootstrap/app.php

    $app->configure('captcha');

Stateless Mode:

You get key and img from this url http://localhost/captcha?config=math and verify the captcha using this method:

    //key is the one that you got from json response
    $rules = ['captcha' => 'required|captcha:'. request('key') . ',math'];

Return Image

captcha();

Return URL

captcha_src();

Return HTML

captcha_img();

To use different configurations

captcha_img('flat');

captcha_img('inverse');

etc.

Based on Intervention Image

Links