erictt / recaptcha
ReCaptcha For Laravel. This repo seperated script and dom which is very helpful for lazyload.
0.0.5
2017-05-19 04:20 UTC
Requires
- php: >=5.5.5
- guzzlehttp/guzzle: ^6.2
- illuminate/support: 5.0.*|5.1.*|5.2.*|5.3.*|5.4.*
This package is not auto-updated.
Last update: 2024-11-10 02:37:40 UTC
README
- Forked from anhskohbo/no-captcha
- This repo's purpose is to seperate script and dom which is very useful in vuejs.
- Still working on it.
Installation
Add the following line to the require
section of composer.json
:
{ "require": { "erictt/recaptcha": "*" } }
Setup
- Add ServiceProvider to the providers array in
app/config/app.php
.
Erictt\Recaptcha\RecaptchaServiceProvider::class,
and the following to aliases
:
'Recaptcha' => Erictt\Recaptcha\Facades\Recaptcha::class,
-
Run
php artisan vendor:publish --provider="Erictt\Recaptcha\RecaptchaServiceProvider"
. -
In
/config/recaptcha.php
, enter your reCAPTCHA sitekey and secret keys.
Usage
Display reCAPTCHA
{!! Recaptcha->display(['dom', 'script']); !!}
- or seperately
{!! Recaptcha->display(['dom']); !!} {!! Recaptcha->display(['script']); !!}
- Complete HTML codes:
<div class="form-group{{ $errors->has('g-recaptcha-response') ? ' has-error' : '' }}"> <label for="g-recaptcha-response" class="col-md-4 control-label"></label> <div class="col-md-6"> {!! Recaptcha::display(['dom']) !!} @if ($errors->has('g-recaptcha-response')) <span class="help-block"> <strong>{{ $errors->first('g-recaptcha-response') }}</strong> </span> @endif </div> </div>
Validation
Add 'g-recaptcha-response' => 'recaptcha'
to rules array.
PS: I don't think we need require
rule for this.
$validate = Validator::make(Input::all(), [ 'g-recaptcha-response' => 'recaptcha' ]);