Download the PHP package blissjaspis/laravel-recaptcha without Composer
On this page you can find all versions of the php package blissjaspis/laravel-recaptcha. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download blissjaspis/laravel-recaptcha
More information about blissjaspis/laravel-recaptcha
Files in blissjaspis/laravel-recaptcha
Package laravel-recaptcha
Short Description Simple and painless Google reCAPTCHA package for Laravel framework
License MIT
Homepage https://github.com/blissjaspis/laravel-recaptcha
Informations about the package laravel-recaptcha
Laravel ReCAPTCHA
Laravel ReCAPTCHA is a simple package to embed Google reCAPTCHA in your application.
What is reCAPTCHA?
Google developers says: "reCAPTCHA protects you against spam and other types of automated abuse. Here, we explain how to add reCAPTCHA to your site or application."
You can find further info at Google reCAPTCHA Developer's Guide
reCAPTCHA available versions
At this moment there are 3 versions available (for web applications):
- v3, the latest (reCAPTCHA v3)
- v2 checkbox or simply reCAPTCHA v2 (reCAPTCHA v2)
- v2 invisible (Invisible reCAPTCHA)
Get your key first!
First of all you have to create your own API keys here
Follow the instructions and at the end of the process you will find Site key and Secret key. Keep them close..you will need soon!
Requirements
| Dependency | Version |
|---|---|
| PHP | ^8.2 |
| Laravel | ^11.0, ^12.0, ^13.0 |
Installation
You can install the package via composer:
The service provider will be automatically registered.
You can publish the config file with:
This will create a config/recaptcha.php file in your app that you can modify to set your configuration.
Set your API Keys
Open .env file and set RECAPTCHA_SITE_KEY and RECAPTCHA_SECRET_KEY:
RECAPTCHA_SKIP_IP (not required, CSV format) allows you to add a list of IP/CIDR to whitelist.
Configuration
Open config/recaptcha.php configuration file to set your default version and other options. All options are documented inside the configuration file.
!!! IMPORTANT !!! Every time you change your configuration, run
php artisan config:cacheto apply the changes.
Usage
Customize error message
For v2 and invisible reCAPTCHA, you can customize the validation error message. Add your message to the resources/lang/[LANG]/validation.php file:
ReCAPTCHA v2 Checkbox
-
Embed in Blade
Insert
{!! htmlScriptTagJsApi() !!}helper before closing</head>tag in your template.Inside your form, use the
{!! htmlFormSnippet() !!}helper. -
Verify submitted data
Add
recaptchato your validation rules:
ReCAPTCHA v2 Invisible
-
Embed in Blade
Insert
{!! htmlScriptTagJsApi() !!}before closing</head>tag. The form requires an ID that matches the one in yourconfig/recaptcha.php. By default, it'sblissjaspis-recaptcha-invisible-form. You can get it withgetFormId().Use the
{!! htmlFormButton('Submit') !!}helper to generate the submit button. -
Verify submitted data
The validation rule is the same as for v2 checkbox.
ReCAPTCHA v3
-
Embed in Blade
Insert
{!! htmlScriptTagJsApi() !!}before closing</head>tag. You need to pass some configuration.The configuration keys are:
action: The action name for reCAPTCHA v3.callback_then: Javascript function to call on success.callback_catch: Javascript function to call on error.custom_validation: Your own Javascript validation function.
-
Handling validation
The package provides a built-in Javascript validation system that makes an AJAX call to the validation route. You can define
callback_thenandcallback_catchfunctions to handle the response.Alternatively, you can provide a
custom_validationfunction to handle the token yourself.
License
This package is open-sourced software licensed under the MIT license.
All versions of laravel-recaptcha with dependencies
illuminate/routing Version ^11.0 || ^12.0 || ^13.0
illuminate/support Version ^11.0 || ^12.0 || ^13.0