Captcha is a simple easy to use package for Laravel.
installing Captcha Composer Package Note: If you do not have Composer yet, you can install it by following the instructions on https://getcomposer.org
composer require kashif/captcha
in config/app.php add following line
Kashif\Captcha\CaptchaServiceProvider::class,
To publish the assets run the below command.
php artisan vendor:publish --tag=kashif
In Controller include and call captcha facade and send variable to view and print this variable in view as below
use Kashif\Captcha\Captcha;
$captcha = Captcha::render();
return view('view',compact('captcha'));
{!! $captcha !!}
If you want to use a helper function to create the captcha use below function.
captcha();
Also a directive is available to render captcha in balde view, for this we just need to add below directive into the blade.
@captcha
To verify captcha text you need to call verify facade in controller and pass the text entered by user and it will return ture or false.
Captcha::verify("captcha text");
A helper function is also available to verify the captcha
captcha_verify("captcha text");