Implement Captcha Code in Laravel
Learn how to integrate Mewis Captcha Code in your Laravel application with step-by-step instructions. Follow our guide to ensure your website is protected from spam and automated bot attacks.
To implement a Mewis captcha in Laravel, you can follow the steps below:
- Install the Mewis captcha package via composer. Run the following command in your terminal:
composer require mewis/mewis-captcha
- Add the captcha service provider to your
config/app.php
file:'providers' => [ // other providers... Mewis\Captcha\CaptchaServiceProvider::class, ],
- Publish the captcha config file:
php artisan vendor:publish --provider="Mewis\Captcha\CaptchaServiceProvider" --tag=config
- In your form, add the captcha field with the
mewis_captcha
validation rule:
- In your form validation rules, add the
mewis_captcha
rule to thecaptcha
field:
$request->validate([ 'name' => 'required', 'email' => 'required|email', 'captcha' => 'required|mewis_captcha', ]);
That's it! You should now have a Mewis captcha in your Laravel form.