vinkas/laravel-recaptcha
Google reCAPTCHA Validator Package for Laravel Framework
472
1
| Install | |
|---|---|
composer require vinkas/laravel-recaptcha |
|
| Latest Version: | v1.0.1 |
| License: | MIT |
| Last Updated: | Nov 6, 2024 |
| Links: | GitHub · Packagist |
Maintainer: vinothkannans
Laravel Recaptcha Validator
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
Related Packages
doctrine/dbal
Powerful PHP database abstraction layer (DBAL) with many features for database s...
637,827,751
9,703
laravel/serializable-closure
Laravel Serializable Closure provides an easy and secure way to serialize closur...
413,412,504
609
nunomaduro/collision
Cli error handling for console/command-line PHP applications.
394,964,158
4,660
Version History
| Version | Released | Laravel | License |
|---|---|---|---|
| v1.0.1 | ^5.2 | MIT | |
| v1.0.0 | ^5.2 | MIT |