Easily add Google Recaptcha V2 to your Laravel application forms
justijndepover/laravel-google-recaptcha-v2 is a Laravel package for easily add google recaptcha v2 to your laravel application forms.
It currently has 0 GitHub stars and 52 downloads on Packagist (latest version 0.2.0).
Install it with composer require justijndepover/laravel-google-recaptcha-v2.
Discover more Laravel packages by justijndepover
or browse all Laravel packages to compare alternatives.
Last updated
Easily add Google Recaptcha V2 to your Laravel application forms
This application is still in development and could implement breaking changes. Please use at your own risk.
This package adds an easy integration to implement google recaptcha v2 in your Laravel application and validate your request.
You can install the package with composer
composer require justijndepover/laravel-google-recaptcha-v2
After installation you can optionally publish your configuration file
php artisan vendor:publish --tag="laravel-google-recaptcha-v2-config"
This is the config file
return [
/*
* Your Google Recaptcha key
*/
'key' => env('GOOGLE_RECAPTCHA_KEY'),
/*
* Your Google Recaptcha secret
*/
'secret' => env('GOOGLE_RECAPTCHA_SECRET'),
/*
* Skip recaptcha validation in local development
*/
'skip_in_local_development' => true,
];
The package has a default option to skip validation in local development
include the following API keys in your .env files:
GOOGLE_RECAPTCHA_KEY=yourkey
GOOGLE_RECAPTCHA_SECRET=yoursecret
include the following in your app layout to render the recaptcha:
@recaptcha
Because some js frameworks (like Vue) don't allow to have script tags inside your components, this line is required as well:
// before the closing body tag
@recaptchaScript
After that, your request can be validated with the recaptcha validation rule:
$request->validate([
'g-recaptcha-response' => ['recaptcha'],
])
If you find any security related issues, please open an issue or contact me directly at [email protected].
If you wish to make any changes or improvements to the package, feel free to make a pull request.
The MIT License (MIT). Please see License File for more information.