pherum / laravel-recaptcha
google-recaptcha for Laravel 5
Installs: 1 857
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- google/recaptcha: ^1.2
- illuminate/http: ^5.8 || ^6.0 || ^7.0 || ^8.0
- illuminate/support: ^5.8 || ^6.0 || ^7.0 || ^8.0
Requires (Dev)
- mockery/mockery: ^1.4
- phpunit/phpunit: ^8.5 || ^9.0
README
Description
Laravel Recaptcha is a free CAPTCHA service that protect websites from spam and abuse.
Install
Via Composer
composer require pherum/laravel-recaptcha
And then, if using Laravel 5, include the service provider within app/config/app.php
.
'providers' => [ ... PheRum\Recaptcha\RecaptchaServiceProvider::class, ];
And, for convenience, add a facade alias to this same file at the bottom:
'aliases' => [ ... 'Recaptcha' => PheRum\Recaptcha\Facades\Recaptcha::class, ];
Configuration
Laravel Recaptcha supports optional configuration.
To get started, you'll need to publish all vendor assets:
php artisan vendor:publish --provider="PheRum\Recaptcha\RecaptchaServiceProvider"
This will create a config/recaptcha.php
file in your app that you can modify to set your configuration. Also, make sure you check for changes to the original config file in this package between releases.
Usage
Validate a captcha in controller
$this->validate($request, [ 'g-recaptcha-response' => 'required|recaptcha', ]);
Render captcha
{!! Recaptcha::render() !!}
Render captcha with options
{!! Recaptcha::render(['lang' => 'en']) !!}
Testing
composer test
Security
If you discover any security related issues, please email pherum@mail.ru instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.