Download the PHP package crazyinventor/laravel5-recaptcha2 without Composer
On this page you can find all versions of the php package crazyinventor/laravel5-recaptcha2. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download crazyinventor/laravel5-recaptcha2
More information about crazyinventor/laravel5-recaptcha2
Files in crazyinventor/laravel5-recaptcha2
Package laravel5-recaptcha2
Short Description A package to use Google Recaptcha V2 with Laravel 5
License MIT
Informations about the package laravel5-recaptcha2
laravel5-recaptcha2
Recaptcha v2 for Laravel 5. Inspired by anhskohbo/no-captcha and greggilbert/recaptcha.
Installation
Run 'composer require crazyinventor/laravel5-recaptcha2' or modify your composer.json:
Configuration
Get your keys for recaptcha from the admin page.
Then register the Service Provider.
Laravel 5.0
In /config/app.php
, add the following to providers
:
and the following to aliases
:
Laravel 5.1 and newer
In /config/app.php
, add the following to providers
:
and the following to aliases
:
Publish config file
Publish the recaptcha
configuration file by running the following command from a shell inside your Laravel's installation directory:
This will create the file config/recaptcha.php
in your Laravel's installation directory. You can modify this file by entering your sitekey and secret directly to it or adding the keys to your .env file.
.env file
Add RECAPTCHA_SECRET
and RECAPTCHA_SITEKEY
to your .env file:
Replace [secret-key]
and [site-key]
with your keys.
Usage
- In your form, use
{!! Recaptcha::render() !!}
to echo out the markup. - To validate your form, add the following rule:
Testing
When testing your application you might want to skip the recaptcha part. To do so add these lines at the start of your test:
Testing with Laravel 5.4 and Dusk
Unfortunately, mocking does not work for Laravel Dusk. But you can overwrite the validator function very easily by adding the following code to your test.