cohensive / recaptcha
Laravel 4 bridge for recaptcha/php5
Installs: 138
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/cohensive/recaptcha
Requires
- php: >=5.3.0
- recaptcha/php5: dev-master
This package is auto-updated.
Last update: 2025-10-08 09:27:38 UTC
README
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.