2017 © Pedro Peláez
 

library laravel-recaptcha

reCAPTCHA v2 and Invisible reCAPTCHA for laravel

image

daikazu/laravel-recaptcha

reCAPTCHA v2 and Invisible reCAPTCHA for laravel

  • Wednesday, March 7, 2018
  • by daikazu
  • Repository
  • 1 Watchers
  • 0 Stars
  • 45 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 137 % Grown

The README.md

Laravel reCAPTCHA

reCAPTCHA v2 and Invisible reCAPTCHA for Laravel

Easily add Google's V2 and Invisable reCaptcha to your forms;, (*1)

This code is borrowed heavily from anhskohbo/no-captcha, (*2)

Installation

composer require daikazu/laravel-recaptcha

Setup

NOTE This package supports Laravel 5.5 auto-discovery, so you can skip the setup if you are using 5.5 and above., (*3)

LARAVEL 5

Configuration

Public Config File recaptcha.php, (*4)

php artisan vendor:publish --provider="Daikazu\LaravelRecaptcha\ReCaptchaServiceProvider"

Add your RECAPTCHA_SECRET and RECAPTCHA_SITEKEY into your .env file:, (*5)

RECAPTCHA_SECRET=secret-key
RECAPTCHA_SITEKEY=site-key

(You can obtain them from here), (*6)

Usage

Initialize javascript source:

With default options :, (*7)

 {!! ReCaptcha::renderJs() !!}

With language support or onloadCallback option :, (*8)

 {!! ReCaptcha::renderJs('fr', true, 'recaptchaCallback') !!}

Display reCAPTCHA V2

{!! ReCaptcha::displayWidget() !!}

With custom attributes (theme, size, callback ...) :, (*9)

{!! ReCaptcha::displayWidget(['data-theme' => 'dark']) !!}

Display Invisible reCAPTCHA button

{!! ReCaptcha::displayButton( 'Button Text', ['data-callback' => 'onFormSubmit', 'class' => 'button is-info']) !!}

Validation

Add 'g-recaptcha-response' => 'required|recaptcha' to to validation rules array;, (*10)

$validate = Validator::make(Input::all(), [
    'g-recaptcha-response' => 'required|recaptcha'
]);

Then check for reCAPTCHA errors in the form:, (*11)

@if ($errors->has('g-recaptcha-response'))
    <span class="help-block">
        <strong>{{ $errors->first('g-recaptcha-response') }}</strong>
    </span>
@endif

Testing

Comming soon!, (*12)

The Versions

07/03 2018

dev-master

9999999-dev

reCAPTCHA v2 and Invisible reCAPTCHA for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Wall

laravel captcha recaptcha laravel-recaptcha

07/03 2018

v0.0.1

0.0.1.0

reCAPTCHA v2 and Invisible reCAPTCHA for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Wall

laravel captcha recaptcha laravel-recaptcha