Commit 9550ea13 authored by Nguyen Van Anh's avatar Nguyen Van Anh

Update README.md

parent 3889b484
...@@ -3,6 +3,7 @@ No CAPTCHA reCAPTCHA [![Build Status](https://travis-ci.org/anhskohbo/no-captcha ...@@ -3,6 +3,7 @@ No CAPTCHA reCAPTCHA [![Build Status](https://travis-ci.org/anhskohbo/no-captcha
![recaptcha_anchor 2x](https://cloud.githubusercontent.com/assets/1529454/5291635/1c426412-7b88-11e4-8d16-46161a081ece.gif) ![recaptcha_anchor 2x](https://cloud.githubusercontent.com/assets/1529454/5291635/1c426412-7b88-11e4-8d16-46161a081ece.gif)
> For Laravel 4 use [v1](https://github.com/anhskohbo/no-captcha/tree/v1) branch.
## Installation ## Installation
...@@ -11,14 +12,14 @@ Add the following line to the `require` section of `composer.json`: ...@@ -11,14 +12,14 @@ Add the following line to the `require` section of `composer.json`:
```json ```json
{ {
"require": { "require": {
"anhskohbo/no-captcha": "*" "anhskohbo/no-captcha": "2.*"
} }
} }
``` ```
Run `composer update`. Run `composer update`.
## Laravel ## Laravel 5
### Setup ### Setup
...@@ -29,52 +30,22 @@ Add ServiceProvider to the providers array in `app/config/app.php`. ...@@ -29,52 +30,22 @@ Add ServiceProvider to the providers array in `app/config/app.php`.
``` ```
### Configuration ### Configuration
Run `php artisan config:publish anhskohbo/no-captcha` (`publish:config` if you use Laravel 5).
Fill secret and sitekey config in `app/config/packages/anhskohbo/no-captcha/config.php` file: Add `NOCAPTCHA_SECRET` and `NOCAPTCHA_SITEKEY` in **.env** file:
```php ```
<?php NOCAPTCHA_SECRET=[secret-key]
NOCAPTCHA_SITEKEY=[site-key]
return array(
'secret' => '',
'sitekey' => '',
);
``` ```
### Usage ### Usage
##### Display reCAPTCHA ##### Display reCAPTCHA
Insert reCAPTCHA inside your form using one of this examples:
For Laravel 4
```php
<?php echo Form::captcha() ?>
````
For Laravel 4 using Blade syntax
```php
{{ Form::captcha() }}
```
For Laravel 5
```php
<?php echo app('captcha')->display(); ?>
```
For Laravel 5 using Blade syntax
```php ```php
{!! app('captcha')->display(); !!} {!! app('captcha')->display(); !!}
``` ```
For Laravel 5 with `illuminate/html` package using Blade syntax
```php
{!! Form::captcha() !!}
```
##### Validation ##### Validation
Add `'g-recaptcha-response' => 'required|captcha'` to rules array. Add `'g-recaptcha-response' => 'required|captcha'` to rules array.
...@@ -87,7 +58,6 @@ $validate = Validator::make(Input::all(), [ ...@@ -87,7 +58,6 @@ $validate = Validator::make(Input::all(), [
``` ```
## Without Laravel ## Without Laravel
Checkout example below: Checkout example below:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment