vinkas0 / laravel-recaptcha by vinothkannans

Google reCAPTCHA Validator Package for Laravel Framework
429
1
2
Package Data
Maintainer Username: vinothkannans
Maintainer Contact: vinoth.kannan@vinkas.com (Vinoth Kannan)
Package Create Date: 2016-07-11
Package Last Update: 2024-11-06
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-11-19 03:01:27
Package Statistics
Total Downloads: 429
Monthly Downloads: 2
Daily Downloads: 0
Total Stars: 1
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

Laravel Recaptcha Validator

Latest Stable Version Latest Unstable Version License

Google reCAPTCHA Validator Package for Laravel Framework

Installation

Via Composer Require

You may install by running the composer require command in your terminal:

composer require vinkas/laravel-recaptcha

Configuration

Add Service Provider to your config/app.php file

Vinkas\Laravel\Recaptcha\ServiceProvider::class,

And run php artisan command to publish package config file

php artisan vendor:publish --provider="Vinkas\Laravel\Recaptcha\ServiceProvider"

Add your recaptcha site key and secret in .env file

RECAPTCHA_SITE_KEY=__________
RECAPTCHA_SECRET=__________

Add recaptcha custom error message in resources\lang\en\validation.php file

'recaptcha'            => 'The capcha verfication failed. Please try again.',

Add recaptcha field in your form's blade view

<div class="g-recaptcha" data-sitekey="{{ getenv('RECAPTCHA_SITE_KEY') }}"></div>

@if ($errors->has('g-recaptcha-response'))
  {{ $errors->first('g-recaptcha-response') }}
@endif

Add Validator calling function in your app controller file

Validator::make($data, [
  'g-recaptcha-response' => 'required|recaptcha',
]);

It's done! Now your form spam protected by Google reCAPTCHA!!!

Dependencies

Google Recaptcha