Download the PHP package vlinde/recaptcha without Composer
On this page you can find all versions of the php package vlinde/recaptcha. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vlinde/recaptcha
More information about vlinde/recaptcha
Files in vlinde/recaptcha
Package recaptcha
Short Description Laravel package for Google Recaptcha v3
License MIT
Informations about the package recaptcha
Laravel Recaptcha v3
Laravel package for Google Recaptcha v3
Some of the features for Recaptcha:
- Configurable and Customizable
- Callback function
- Service Container
- Auto discovery (only laravel 5.5+)
Requirements:
- Laravel 5.3 or higher
- PHP 5.6.4 or higher
Installation
-
Install the package via composer:
-
Register Provider and Facade in config/app.php (Required for Laravel 5.3 and 5.4):
-
Publish config and views:
-
Done
Configuration
Add RECAPTCHA_SITE_KEY
and RECAPTCHA_SECRET_KEY
to .env
file:
to set more, open config/recaptcha.php and set your own configurations.
Usage
-
Render JS
-
Create Recaptcha field
this is a hidden input field that gets filled with a recaptcha token.
-
Validate
-
Done
Custom Validation Message
Add the following values to the custom
array in the validation
language file:
Then check for captcha errors in the Form:
Validate Score Manually
Alternatively, you can get the score and take variable action:
Methods
RenderJs
Argument Index | Argument Name | Default | Example | Type | Description |
---|---|---|---|---|---|
0 | language | null | fa | string |
Field
Argument Index | Argument Name | Default | Example | Type | Description |
---|---|---|---|---|---|
0 | action | home | string | Name of your action | |
1 | name | g-recaptcha-response | recaptcha_field | string | Value of name attribute for hidden file input |
2 | attributes | [] | ['id' => 'recaptcha-id', 'class' => 'form-element', 'required'] | array | Array of attributes to render inside input field |
3 | callback | null | recaptchaCallback | string | Sometimes you want to use token with js. package will send token to your callback function |
Validation
Argument Index | Argument Name | Default | Example | Type | Description |
---|---|---|---|---|---|
0 | action | home | string | Name of your action | |
1 | score | loaded from config | 0.7 | float | It's optional |
Complete Example
View:
Controller:
Migration Guide
from 1.0.0 to 1.1.0
- delete
app/recaptcha.php
file - delete
resources/views/vendor/recaptcha
directory - publish vendor again
Changelog
Refer to the Changelog for a full history of the project.
License
This software is released under The MIT License (MIT).
(c) 2018 Mostafaznv, All rights reserved.
All versions of recaptcha with dependencies
illuminate/support Version ~5|~6|~7|~8|~9
guzzlehttp/guzzle Version ^7.5