jbrathod/math-captcha

A captcha that uses multiple time in one website

dev-main 2022-08-02 09:35 UTC

This package is not auto-updated.

Last update: 2025-07-02 03:23:08 UTC


README

A captcha that will be used for multiple pages/places in single website.

Installation Guide

composer require jbrathod/math-captcha

Find the providers key in config/app.php and register the Captcha Service Provider.

    'providers' => [
        // ...
        'Jbrathod\MathCaptcha\MathCaptchaServiceProvider',
    ]

for Laravel 5.1+

    'providers' => [
        // ...
        Jbrathod\MathCaptcha\MathCaptchaServiceProvider::class,
    ]

Usage

Add captcha image to form (Note : "contact-us" is page name)

<img src="{{ app('mathcaptcha')->image('contact-us') }}"/>

Validate captcha

Add 'captcha' => 'required|mathcaptcha:contact-us' to rules array.

$this->validate($request, [
    'captcha' => 'required|mathcaptcha:contact-us',
]);

Reset captcha after form submit without errors

app('mathcaptcha')->reset('contact-us');