KaneCohen / laravel-recaptcha by KaneCohen

Laravel 4 bridge for recaptcha/php5
137
0
2
Package Data
Maintainer Username: KaneCohen
Maintainer Contact: kanecohen@gmail.com (Kane Cohen)
Package Create Date: 2013-09-07
Package Last Update: 2014-10-26
Language: PHP
License: BSD-3-Clause
Last Refreshed: 2024-11-19 03:16:37
Package Statistics
Total Downloads: 137
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

reCaptcha for Laravel 4

Installation

Add following require to your composer.json file:

    "cohensive/recaptcha": "dev-master"

Then run composer install or composer update to download it and autoload.

In providers array you need to add new package:

'providers' => array(

    //...
    'Cohensive\Recaptcha\RecaptchaServiceProvider',
    //...

)

In aliases:

'aliases' => array(

    //...
    'Recaptcha' => 'Cohensive\Recaptcha\Facades\Recaptcha'
    //...

)

And after all that, we need to add config file, which will hold our private and public keys. Run following line in command line:

    php artisan config:publish cohensive/recaptcha

Your public and private key could be found in Google reCaptcha account page.

Usage

Insert Recaptcha javascript code into your page (check your Google reCaptcha account).

Then, all you need is to insert a new rule to your validator on your POST processing page:

  return [
    'recaptcha_response_field' => 'recaptcha'
  ];

recaptcha rule can be added to any input attribute, just make sure to translate it correcly in your language file.