Download the PHP package vizuaalog/laravel-recaptcha without Composer
On this page you can find all versions of the php package vizuaalog/laravel-recaptcha. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-recaptcha
Laravel reCaptcha
If you have publically available forms, it may be a good idea to have some form of captcha. This will help reduce the amount of spam you receive from robots submitting that form.
reCaptcha is Googles take on captchas. Your user doesn't have to type out any hard to see text, instead, they may only need to simply click the checkbox. If the API is unsure as to whether that was a 'humanly' click then your user will be asked to do something involving pictures.
I regularly use reCaptcha in both my private and professional work. I also use Laravel. And it can be annoying having to type out the reCaptcha checking code. So Laravel reCaptcha was born.
Installation
To install Laravel reCaptcha simple add it to your :
Alternatively add it via the composer CLI:
Then add the facade and provider to your file within your Laravel app:
Configuration
Before you can use Laravel reCaptcha you will first need to configure a sitekey and secret via [https://www.google.com/recaptcha/admin](the reCaptcha dashboard).
Once setup update your file to include the following:
Usage
Within your form, you will need to render the reCaptcha box. You can do this by using the following method where you would like the box to show:
At the top of your controller you need to add a use statement to load in the Recaptcha
facade, this is automatically registered via the RecaptchaServiceController
.
Within your controller where your form posts you can use the following method to check if the captcha was successful. This returns a boolean value:
If the check fails you can access the errors received from the API using the following method, this returns an array of the errors:
Below is an example controller showing a potential 'real world' example.
Issues / contribution
If you notice any bugs, issues or would like the contribute to this project then please submit an issue or pull request detailing the bug or contribution.