Skip to content

Latest commit

 

History

History
64 lines (44 loc) · 1.7 KB

README.md

File metadata and controls

64 lines (44 loc) · 1.7 KB

Recaptcha

Build Status StyleCI Latest Stable Version Total Downloads

A laravel package for easy ReCAPTCHA integration

Installation

composer require binarycabin/recaptcha

Publish your configuration file

php artisan vendor:publish --provider="BinaryCabin\Recaptcha\Providers\RecaptchaServiceProvider" --tag="config"

Update your environment variables:

RECAPTCHA_VERSION=3
RECAPTCHA_SITE_KEY=""
RECAPTCHA_SECRET_KEY=""

For local sites or test environments you can also disable recaptcha verification using:

RECAPTCHA_ENABLE=false

Usage

At the end of your page, add the scripts needed for Google Recaptcha:

{!! Recaptcha::scripts() !!}

And within your form, add the hidden input that will contain your recaptcha token:

{!! Recaptcha::hiddenInput() !!}

Finally, add the validation in your controller:

$this->validate($request, [
    'recaptcha-token' => 'recaptcha',
]);

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT