mannysoft/recaptcha is a Laravel package for recaptcha validator for laravel 5.
It currently has 0 GitHub stars and 31 downloads on Packagist (latest version 2.2.0).
Install it with composer require mannysoft/recaptcha.
Discover more Laravel packages by mannysoft
or browse all Laravel packages to compare alternatives.
Last updated
A reCAPTCHA Validator for Laravel 5.
(Looking for a Laravel 4 version? Pull the latest 1.x tag. For Laravel 5.0, pull the latest 2.0 tag.)
tldr; I don't really have time to maintain this package on my own, so I'm looking for help. If you're interested, leave a note on #146. Thanks!
Add the following line to the require section of composer.json:
{
"require": {
"greggilbert/recaptcha": "dev-master"
}
}
/config/app.php, add the following to providers:Greggilbert\Recaptcha\RecaptchaServiceProvider::class,
and the following to aliases:
'Recaptcha' => Greggilbert\Recaptcha\Facades\Recaptcha::class,
php artisan vendor:publish --provider="Greggilbert\Recaptcha\RecaptchaServiceProvider"./config/recaptcha.php, enter your reCAPTCHA public and private keys.version to 1.resources/lang/[lang]/validation.php: 'recaptcha' => 'The :attribute field is not correct.',
{!! Recaptcha::render() !!} to echo out the markup. $rules = [
// ...
'g-recaptcha-response' => 'required|recaptcha',
];
{!! Recaptcha::render() !!} to echo out the markup. $rules = [
// ...
'recaptcha_response_field' => 'required|recaptcha',
];
It's also recommended to add required when validating.
reCAPTCHA v2 allows for customization of the widget through a number of options, listed at the official documentation. You can configure the output of the captcha through six allowed keys: theme, type, lang, callback, tabindex and expired-callback.
In the config file, you can create an options array to set the default behavior. For example:
// ...
'options' => [
'lang' => 'ja',
],
would default the language in all the reCAPTCHAs to Japanese. If you want to further customize, you can pass options through the render option:
echo Recaptcha::render([ 'lang' => 'fr' ]);
Options passed into Recaptcha::render will always supercede the configuration.
To change the language of the captcha, simply pass in a language as part of the options:
'options' => [
'lang' => 'fr',
],
For a list of valid language codes, consulting the official documentation.
Alternatively, if you want to set a default template instead of the standard one, you can use the config:
// ...
'template' => 'customCaptcha',
or you can pass it in through the Form option:
echo Recaptcha::render([ 'template' => 'customCaptcha' ]);
For the v1 customization options, consult the old documentation and apply accordingly.
Because of Google's way of displaying the reCAPTCHA, this package won't work if you load your form from an AJAX call. If you need to do it, you should use one of the alternate methods provided by Google.