2017 © Pedro Peláez
 

library laravel-math-captcha

A simple math captcha for Laravel form validation.

image

elic-dev/laravel-math-captcha

A simple math captcha for Laravel form validation.

  • Tuesday, May 16, 2017
  • by elic-dev
  • Repository
  • 1 Watchers
  • 1 Stars
  • 1,113 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 4 Versions
  • 12 % Grown

The README.md

Very simple math captcha for Laravel5

A simple math question (+,-,*) to validate user input., (*1)

Installation

composer require elic-dev/laravel-math-captcha

Setup Laravel > 5.5

This package supports Laravel Package Auto-Discovery., (*2)

Setup Laravel <= 5.4

You can add the ServiceProvider to the providers array in app/config/app.php., (*3)

ElicDev\MathCaptcha\MathCaptchaServiceProvider::class,

Usage

This package only returns the question and the input. You have to position it within your labels and form classes., (*4)

{{ app('mathcaptcha')->label() }}
{!! app('mathcaptcha')->input() !!}

Display it wihtin Bootstrap as example:, (*5)

<div class="form-group">
    <label for="mathgroup">Please solve the following math function: {{ app('mathcaptcha')->label() }}</label>
    {!! app('mathcaptcha')->input(['class' => 'form-control', 'id' => 'mathgroup']) !!}
    @if ($errors->has('mathcaptcha'))
        <span class="help-block">
            <strong>{{ $errors->first('mathcaptcha') }}</strong>
        </span>
    @endif
</div>

Looks like, (*6)

MathCaptcha Bootstrap, (*7)

Validation

Add 'mathcaptcha' => 'required|mathcaptcha' to rules array., (*8)

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

Add corresponding translation string to your lang/validation.php files., (*9)

Reset

This package does not generate a new math question for each request. Once the form has been submited without validation erros you can reset the library to force generate a new question., (*10)

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

Configuration

Operands, Min, Max

You can adjust the available operands (+,-,*) and minimum or maximum randum values used. Some users might stuggle with more complex math operations., (*11)

php artisan vendor:publish --provider="ElicDev\MathCaptcha\MathCaptchaServiceProvider" --tag=config

Display as text

It is possible to show the math question as text (e.g. "Four plus Five"). You can adjust a setting in the config file. This requires translations and a language files. A few languages are provided with this package., (*12)

php artisan vendor:publish --provider="ElicDev\MathCaptcha\MathCaptchaServiceProvider" --tag=lang

The Versions

16/05 2017

dev-master

9999999-dev

A simple math captcha for Laravel form validation.

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by Matthias Lill

laravel captcha math laravel5 math-captcha

16/05 2017

1.0.2

1.0.2.0

A simple math captcha for Laravel form validation.

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by Matthias Lill

laravel captcha math laravel5 math-captcha

19/04 2017

1.0.1

1.0.1.0

A simple math captcha for Laravel form validation.

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by Matthias Lill

laravel captcha math laravel5 math-captcha

19/04 2017

1.0.0

1.0.0.0

A simple math captcha for Laravel form validation.

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by Matthias Lill

laravel captcha math laravel5 math-captcha