Download the PHP package bkstar123/laravel-recaptcha without Composer
On this page you can find all versions of the php package bkstar123/laravel-recaptcha. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bkstar123/laravel-recaptcha
More information about bkstar123/laravel-recaptcha
Files in bkstar123/laravel-recaptcha
Package laravel-recaptcha
Short Description Google reCaptcha v2 checkbox & v3 validation
License MIT
Informations about the package laravel-recaptcha
laravel-recaptcha
This package adds reCaptcha_v2 Checkbox and reCaptcha_v3 validation. Both versions of reCaptcha can be used together
1.Requirements
It is recommended to install this package with PHP version 7.1.3+ and Laravel Framework version 5.5+
2.Installation
composer require bkstar123/laravel-recaptcha
For reCaptcha_v2 Checkbox
, add the following settings in the .env file:
For reCaptcha_v3
, add the following settings in the .env file:
(optional, by default set to 0.5)
3. Usage for reCaptcha v2 checkbox
3.1 In Blade view
You can add Google reCaptcha v2 validation to your site by simply calling
Note: Recaptcha alias is automatically registered, so you do not need to add it in the config/app.php
The following input will be automatically added to your view and being validated in the validation logic
You can also display the validation result to the view as follows (use CSS styling to highlight the validation error):
3.2 In validation logic
You can use a new custom validation rule recaptcha
against the attribute g-recaptcha-response
, for example:
4. Usage for reCaptcha v3
4.1 In Blade view
Firstly, you need to call addClient3Html()
method on Recaptcha
facade, for example:
This call will create a hidden input as follows:
You can display the validation error by adding the following snippet:
Secondly, you need to call addClient3Js()
method on Recaptcha
facade, for example:
This call will create a Javascript block as follows:
4.2 In Validation logic
You can use a new custom validation rule recaptcha_v3
against the attribute recaptcha3
, for example:
Note:
- You can give an arbitrary name for
action_name
as long as it contains only a-z, A-Z and _ - Also for attribute name, you can use an arbitrary string other than
recaptcha3