Downloads
Stars
Version
Working on Laravel 5. French, English and Spanish!!!
Install with composer :
composer require lucbu\laravelcaptcha dev-master
Just add in the array providers
in the file config\app.php
:
'Lucbu\LaravelCaptcha\CaptchaServiceProvider',
Publish the package using the command :
php artisan vendor:publish --provider="Lucbu\LaravelCaptcha\CaptchaServiceProvider"
In the file config\lucbu-laravelcaptcha.php
there is some parameters that you can modify:
In the form view, just use the following code :
@include('lucbu-laravelcaptcha::captcha')
You can validate the fields that has to be fulfill with captcha with the rule lucbularavelcaptcha
:
public function rules() {
return [
'captcha' => 'required|lucbularavelcaptcha:is_caseSensitive'
];
}
You can set the parameters is_caseSensitive as 'true' or 'false', the validation will take care or not of matching the case (false by default).
You can generate a captcha in a controller like this :
<?php namespace App\Http\Controllers;
use Lucbu\LaravelCaptcha\Services\Captcha;
class ExampleController {
public function exampleFunction(){
Captcha::generateCaptcha();
}
}
The function will create the captcha and store into the session variable.
You can also get just the image using the route lucbu.laravelcaptcha.image
or the sound with the route lucbu.laravelcaptcha.sound
.
The player used to play the sound is based on HTML5. (<audio>
tag)