Git Product home page Git Product logo

recaptcha's Introduction

Recaptcha

A reCAPTCHA Validator for Laravel 4.

Installation

Add the following line to the require section of composer.json:

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

Laravel 4 Setup

  1. Add Greggilbert\Recaptcha\RecaptchaServiceProvider to the service provider list in app/config/app.php.
  2. Run php artisan config:publish greggilbert/recaptcha.
  3. In app/config/packages/greggilbert/recaptcha/config.php, enter your reCAPTCHA public and private keys.
  4. Add the following line into app/lang/[lang]/validation.php:
    "recaptcha" => 'The :attribute field is not correct.',

Usage

  1. In your form, use Form::captcha() to echo out the markup.
  2. In your validation rules, add the following:
    $rules = array(
        // ...
        'recaptcha_response_field' => 'required|recaptcha',
    };

It's also recommended to add required when validating.

Customization

reCAPTCHA allows for customization of the widget through a number of options, listed at the official documentation. You can configure the output of the captcha in several ways.

In the config.php, you can create an options array to set the default behavior. For example:

    // ...
    'options' => array(
		'theme' => 'white',
	),

would default all the reCAPTCHAs to the white theme. If you want to further customize, you can pass options through the Form option:

echo Form::captcha(array('theme' => 'blackglass'));

Options passed into Form::captcha will always supercede the configuration.

recaptcha's People

Contributors

chrisreid avatar greggilbert avatar heathnaylor avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.