2017 © Pedro Peláez
 

library recaptcha

reCAPTCHA Validator for Laravel 5

image

greggilbert/recaptcha

reCAPTCHA Validator for Laravel 5

  • Thursday, August 31, 2017
  • by greggilbert
  • Repository
  • 32 Watchers
  • 672 Stars
  • 657,735 Installations
  • PHP
  • 26 Dependents
  • 0 Suggesters
  • 149 Forks
  • 38 Open issues
  • 23 Versions
  • 7 % Grown

The README.md

Abandoned

All good things must come to an end. The sad fact is that I don't have time to maintain this package, so the release of Laravel 6 is as good as any to make a clean break. You should take a look at the forks to see if anyone is carrying on the torch., (*1)

Thanks to everyone for sticking by this package for years!, (*2)

Recaptcha

A reCAPTCHA Validator for Laravel 5., (*3)

Installation

Add the following line to the require section of composer.json:, (*4)

{
    "require": {
        "greggilbert/recaptcha": "dev-master"
    }
}

Setup

  1. In /config/app.php, add the following to providers:, (*5)

    Greggilbert\Recaptcha\RecaptchaServiceProvider::class,
    

    and the following to aliases:, (*6)

    'Recaptcha' => Greggilbert\Recaptcha\Facades\Recaptcha::class,
    
  2. Run php artisan vendor:publish --provider="Greggilbert\Recaptcha\RecaptchaServiceProvider".
  3. In /config/recaptcha.php, enter your reCAPTCHA public and private keys.
    • If you are not using the most recent version of reCAPTCHA, set version to 1.
    • If you are upgrading to v2 of reCAPTCHA, note that your keys from the previous version will not work, and you need to generate a new set in the reCAPTCHA admin.
  4. The package ships with a default validation message, but if you want to customize it, add the following line into resources/lang/[lang]/validation.php:, (*7)

      'recaptcha' => 'The :attribute field is not correct.',
    

Usage

v2 (No Captcha)

  1. In your form, use {!! Recaptcha::render() !!} to echo out the markup.
  2. In your validation rules, add the following:
    $rules = [
        // ...
        'g-recaptcha-response' => 'required|recaptcha',
    ];

v1 (Legacy)

  1. In your form, use {!! Recaptcha::render() !!} to echo out the markup.
  2. In your validation rules, add the following:
    $rules = [
        // ...
        'recaptcha_response_field' => 'required|recaptcha',
    ];

It's also recommended to add required when validating., (*8)

Customization

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., (*9)

In the config file, you can create an options array to set the default behavior. For example:, (*10)

    // ...
    '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:, (*11)

echo Recaptcha::render([ 'lang' => 'fr' ]);

Options passed into Recaptcha::render will always supercede the configuration., (*12)

Language

To change the language of the captcha, simply pass in a language as part of the options:, (*13)

    'options' => [
        'lang' => 'fr',
    ],

For a list of valid language codes, consulting the official documentation., (*14)

Custom template

Alternatively, if you want to set a default template instead of the standard one, you can use the config:, (*15)

    // ...
    'template' => 'customCaptcha',

or you can pass it in through the Form option:, (*16)

echo Recaptcha::render([ 'template' => 'customCaptcha' ]);

v1 customization

For the v1 customization options, consult the old documentation and apply accordingly., (*17)

Limitation

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., (*18)

The Versions

31/08 2017

dev-master

9999999-dev http://github.com/greggilbert/recaptcha

reCAPTCHA Validator for Laravel 5

  Sources   Download

MIT

The Requires

 

by Greg Gilbert

laravel captcha laravel5 recaptcha

06/04 2017

2.2.0

2.2.0.0 http://github.com/greggilbert/recaptcha

reCAPTCHA Validator for Laravel 5

  Sources   Download

MIT

The Requires

 

by Greg Gilbert

laravel captcha laravel5 recaptcha

17/02 2016

2.1.1

2.1.1.0 http://github.com/greggilbert/recaptcha

reCAPTCHA Validator for Laravel 5

  Sources   Download

MIT

The Requires

 

by Greg Gilbert

laravel captcha laravel5 recaptcha

03/01 2016

2.1.0

2.1.0.0 http://github.com/greggilbert/recaptcha

reCAPTCHA Validator for Laravel 5

  Sources   Download

MIT

The Requires

 

by Greg Gilbert

laravel captcha laravel5 recaptcha

19/09 2015

dev-develop

dev-develop http://github.com/greggilbert/recaptcha

reCAPTCHA Validator for Laravel 5

  Sources   Download

MIT

The Requires

 

by Greg Gilbert

laravel captcha laravel5 recaptcha

19/09 2015

2.0.3

2.0.3.0 http://github.com/greggilbert/recaptcha

reCAPTCHA Validator for Laravel 5

  Sources   Download

MIT

The Requires

 

by Greg Gilbert

laravel captcha laravel5 recaptcha

11/05 2015

2.0.2

2.0.2.0 http://github.com/greggilbert/recaptcha

reCAPTCHA Validator for Laravel 5

  Sources   Download

MIT

The Requires

 

by Greg Gilbert

laravel captcha laravel5 recaptcha

11/02 2015

2.0.1

2.0.1.0 http://github.com/greggilbert/recaptcha

reCAPTCHA Validator for Laravel 5

  Sources   Download

MIT

The Requires

 

by Greg Gilbert

laravel captcha laravel5 recaptcha

08/02 2015

2.0.0

2.0.0.0 http://github.com/greggilbert/recaptcha

reCAPTCHA Validator for Laravel 5

  Sources   Download

MIT

The Requires

 

by Greg Gilbert

laravel captcha laravel5 recaptcha

15/12 2014

1.1.5

1.1.5.0 http://github.com/greggilbert/recaptcha

reCAPTCHA Validator for Laravel 4

  Sources   Download

MIT

The Requires

 

by Greg Gilbert

laravel captcha laravel4 recaptcha

14/12 2014

1.1.4

1.1.4.0 http://github.com/greggilbert/recaptcha

reCAPTCHA Validator for Laravel 4

  Sources   Download

MIT

The Requires

 

by Greg Gilbert

laravel captcha laravel4 recaptcha

14/12 2014

1.1.3

1.1.3.0 http://github.com/greggilbert/recaptcha

reCAPTCHA Validator for Laravel 4

  Sources   Download

MIT

The Requires

 

by Greg Gilbert

laravel captcha laravel4 recaptcha

07/12 2014

1.1.2

1.1.2.0 http://github.com/greggilbert/recaptcha

reCAPTCHA Validator for Laravel 4

  Sources   Download

MIT

The Requires

 

by Greg Gilbert

laravel captcha laravel4 recaptcha

06/12 2014

1.1.1

1.1.1.0 http://github.com/greggilbert/recaptcha

reCAPTCHA Validator for Laravel 4

  Sources   Download

MIT

The Requires

 

by Greg Gilbert

laravel captcha laravel4 recaptcha

05/12 2014

1.1.0

1.1.0.0 http://github.com/greggilbert/recaptcha

reCAPTCHA Validator for Laravel 4

  Sources   Download

MIT

The Requires

 

by Greg Gilbert

laravel captcha laravel4 recaptcha

04/03 2014

1.0.7

1.0.7.0 http://github.com/greggilbert/recaptcha

reCAPTCHA Validator for Laravel 4

  Sources   Download

MIT

The Requires

 

by Greg Gilbert

laravel captcha laravel4 recaptcha

28/11 2013

1.0.6

1.0.6.0 http://github.com/greggilbert/recaptcha

reCAPTCHA Validator for Laravel 4

  Sources   Download

MIT

The Requires

 

by Greg Gilbert

laravel captcha laravel4 recaptcha

25/08 2013

1.0.5

1.0.5.0 http://github.com/greggilbert/recaptcha

reCAPTCHA Validator for Laravel 4

  Sources   Download

MIT

The Requires

 

by Greg Gilbert

laravel captcha laravel4 recaptcha

19/06 2013

1.0.4

1.0.4.0 http://github.com/greggilbert/recaptcha

reCAPTCHA Validator for Laravel 4

  Sources   Download

MIT

The Requires

 

by Greg Gilbert

laravel captcha laravel4 recaptcha

04/06 2013

1.0.3

1.0.3.0 http://github.com/greggilbert/recaptcha

reCAPTCHA Validator for Laravel 4

  Sources   Download

MIT

The Requires

 

by Greg Gilbert

laravel captcha laravel4 recaptcha

01/06 2013

1.0.2

1.0.2.0 http://github.com/greggilbert/recaptcha

reCAPTCHA Validator for Laravel 4

  Sources   Download

MIT

The Requires

 

by Greg Gilbert

laravel captcha laravel4 recaptcha

13/05 2013

1.0.1

1.0.1.0 http://github.com/greggilbert/recaptcha

reCAPTCHA Validator for Laravel 4

  Sources   Download

MIT

The Requires

 

by Greg Gilbert

laravel captcha laravel4 recaptcha

27/04 2013

1.0

1.0.0.0 http://github.com/greggilbert/recaptcha

reCAPTCHA Validator for Laravel 4

  Sources   Download

MIT

The Requires

 

by Greg Gilbert

laravel captcha laravel4 recaptcha