Skip to content
This repository was archived by the owner on Jun 10, 2024. It is now read-only.

Commit db47e4d

Browse files
committed
Update README.md
1 parent ef4a928 commit db47e4d

File tree

1 file changed

+1
-121
lines changed

1 file changed

+1
-121
lines changed

README.md

Lines changed: 1 addition & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -12,127 +12,7 @@ Are you still using PHP 5.x or 7.0? Please go to [V2](https://github.com/biscola
1212

1313
## !!! Documentation !!!
1414

15-
Since version 3.2.0 you can find online complete documentation at [https://laravel-recaptcha-docs.biscolab.com/](https://laravel-recaptcha-docs.biscolab.com/).
16-
For previous releases continue reading.
15+
You can find online complete documentation at [https://laravel-recaptcha-docs.biscolab.com/](https://laravel-recaptcha-docs.biscolab.com/).
1716

18-
## Installation
19-
20-
You can install the package via composer:
21-
```sh
22-
composer require biscolab/laravel-recaptcha:^3.0
23-
```
24-
Laravel 5.5 (or greater) uses package auto-discovery, so doesn't require you to manually add the Service Provider, but if you don't use auto-discovery `ReCaptchaServiceProvider` must be registered in `config/app.php`:
25-
```php
26-
'providers' => [
27-
...
28-
Biscolab\ReCaptcha\ReCaptchaServiceProvider::class,
29-
];
30-
```
31-
You can use the facade for shorter code. Add `ReCaptcha` to your aliases:
32-
```php
33-
'aliases' => [
34-
...
35-
'ReCaptcha' => Biscolab\ReCaptcha\Facades\ReCaptcha::class,
36-
];
37-
```
38-
Create `config/recaptcha.php` configuration file using:
39-
```su
40-
php artisan vendor:publish --provider="Biscolab\ReCaptcha\ReCaptchaServiceProvider"
41-
```
42-
43-
## Configuration
44-
45-
### Add your API Keys
46-
Open `.env` file and set `RECAPTCHA_SITE_KEY` and `RECAPTCHA_SECRET_KEY`:
47-
```php
48-
RECAPTCHA_SITE_KEY=YOUR_API_SITE_KEY
49-
RECAPTCHA_SECRET_KEY=YOUR_API_SECRET_KEY
50-
```
51-
52-
Open `config/recaptcha.php` configuration file and set `version`:
53-
```php
54-
return [
55-
'api_site_key' => env('RECAPTCHA_SITE_KEY', ''),
56-
'api_secret_key' => env('RECAPTCHA_SECRET_KEY', ''),
57-
'version' => 'v2' // supported: v2|invisible
58-
'skip_ip' => [] // array of IP addresses - String: dotted quad format e.g.: 127.0.0.1
59-
];
60-
```
61-
For more invermation about Site Key and Secret Key please visit [Google reCAPTCHA developer documentation](https://developers.google.com/recaptcha/docs/start)
62-
Get more info about reCAPTCHA version at https://developers.google.com/recaptcha/docs/versions
63-
**skip_ip** is a list of IP addresses that, if recognized, disable the reCAPTCHA validation (return always true).
64-
65-
### Have you updated?
66-
If you are migrating from an older version add `skip_ip` array in `recaptcha.php` configuration file.
67-
68-
### Customize error message
69-
Before starting please add the validation message to `resources/lang/[LANG]/validation.php` file
70-
```php
71-
return [
72-
...
73-
'recaptcha' => 'Hey!!! :attribute is wrong!',
74-
];
75-
```
76-
77-
## How to use
78-
79-
### Embed in Blade
80-
81-
Insert `htmlScriptTagJsApi($formId)` helper before closing `</head>` tag
82-
You can also use `ReCaptcha::htmlScriptTagJsApi($formId)`.
83-
`$formId` is required only if you are using **ReCAPTCHA INVISIBLE**
84-
```blade
85-
<!DOCTYPE html>
86-
<html>
87-
<head>
88-
...
89-
{!! htmlScriptTagJsApi(/* $formId - INVISIBLE version only */) !!}
90-
or
91-
{!! ReCaptcha::htmlScriptTagJsApi(/* $formId - INVISIBLE version only */) !!}
92-
</head>
93-
```
94-
95-
#### If you are using ReCAPTCHA v2
96-
After you have to insert `htmlFormSnippet()` helper inside the form where you want to use the field `g-recaptcha-response`
97-
You can also use `ReCaptcha::htmlFormSnippet()` .
98-
```blade
99-
<form>
100-
...
101-
{!! htmlFormSnippet() !!}
102-
<input type="submit">
103-
</form>
104-
```
105-
106-
#### If you are using ReCAPTCHA INVISIBLE
107-
After you have to insert `htmlFormButton($buttonInnerHTML)` helper inside the form where you want to use ReCAPTCHA. This function creates submit button therefore **you don't have to insert <input type="submit"> or similar**.
108-
You can also use `ReCaptcha::htmlFormButton($buttonInnerHTML)` .
109-
`$buttonInnerHTML` is what you want to write on the submit button
110-
```blade
111-
<form>
112-
...
113-
{!! htmlFormButton(/* $buttonInnerHTML - Optional */) !!}
114-
</form>
115-
```
116-
117-
## Verify submitted data
118-
119-
Add **recaptcha** to your rules
120-
```php
121-
$v = Validator::make(request()->all(), [
122-
...
123-
'g-recaptcha-response' => 'recaptcha',
124-
]);
125-
```
126-
127-
Print form errors
128-
```php
129-
$errors = $v->errors();
130-
```
131-
132-
## Test
133-
134-
```sh
135-
composer test
136-
```
13717
## License
13818
[![MIT License](https://img.shields.io/github/license/biscolab/laravel-recaptcha.svg)](https://github.com/biscolab/laravel-recaptcha/blob/master/LICENSE)

0 commit comments

Comments
 (0)