Laravel 4 bridge for recaptcha/php5
Add following require to your
composer install or
composer update to download it and autoload.
providers array you need to add new package:
'providers' => array( //... 'Cohensive\Recaptcha\RecaptchaServiceProvider', //... )
'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.
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.