j25 / google-captcha
Google captcha v3.0 for laravel
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/j25/google-captcha
Requires
- php: ^8.2
This package is auto-updated.
Last update: 2025-12-31 00:36:08 UTC
README
Google captcha 3.0 for laravel 10,11
Installation
Require this package with composer:
composer require j25/google-captcha
Update your packages with composer update or install with composer install.
Usage
To use the Google Captcha Service Provider, you have to register the provider in your Laravel framework.
Find the providers key in config/app.php and register the Captcha Service Provider.
'providers' => [ // ... 'J25\GoogleCaptcha\Providers\GoogleCaptchaServiceProvider', ]
Configuration
You can use two captcha keys when you get them in your google account.
Add them in the .ENV file
RE_SITE_KEY ="XXXXXXXXXX" RE_SEC_KEY="XXXXXXXXXX"
Example
view files
//post.blade.php <form action="{{ route ('post')}}"> <x-google-captcha /> </form
controller files
use J25\GoogleCaptcha\GoogleCaptcha; Validator::make($input, [ 'recaptcha_response' => 'required|captcha' ])->validate(); or public function rules(): array { return [ 'name' => ['string'], 'text' => ['string'], 'recaptcha_response' => ['required', new GoogleCaptcha] ]; }