kashif / captcha
This is easy to use captcha package for Laravel
Requires
- php: ^7.3|^8.0
This package is auto-updated.
Last update: 2024-08-30 01:17:42 UTC
README
Captcha is a simple easy to use package for Laravel.
Getting Started
installing Captcha Composer Package Note: If you do not have Composer yet, you can install it by following the instructions on https://getcomposer.org
Step 1. Install package
composer require kashif/captcha
Step 2. Register the Captcha service provider
in config/app.php add following line
Kashif\Captcha\CaptchaServiceProvider::class,
Publish Assets
To publish the assets run the below command.
php artisan vendor:publish --tag=kashif
Using Captcha:
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
Verify 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");