Download the PHP package giantbits/yii2-crelish-recaptcha without Composer
On this page you can find all versions of the php package giantbits/yii2-crelish-recaptcha. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download giantbits/yii2-crelish-recaptcha
More information about giantbits/yii2-crelish-recaptcha
Files in giantbits/yii2-crelish-recaptcha
Package yii2-crelish-recaptcha
Short Description Google reCAPTCHA v3 integration for Yii2 with automatic token refresh. Works seamlessly with AJAX/PJAX forms.
License MIT
Homepage https://github.com/giantbits/yii2-crelish-recaptcha
Informations about the package yii2-crelish-recaptcha
Yii2 Crelish reCAPTCHA v3
Google reCAPTCHA v3 integration for Yii2 and Crelish CMS.
Features
- reCAPTCHA v3 support - Invisible verification, no user interaction required
- Automatic token refresh - Solves the common expired token issue with AJAX/PJAX forms
- Score-based validation - Configure minimum score threshold
- PJAX compatible - Works seamlessly with Yii2 PJAX widgets
- Simple integration - Just add widget and validator to your forms
Installation
Configuration
Add the component to your application config:
Or use environment variables:
Usage
1. Add the attribute to your model
2. Add the widget to your form
With ActiveForm (PHP):
With Twig (Crelish CMS):
3. Works with PJAX
The widget automatically handles PJAX forms. No additional configuration needed:
Validator Options
Widget Options
How It Works
Unlike other reCAPTCHA v3 implementations that generate a token on page load (which expires after ~2 minutes), this package:
- Intercepts form submission
- Requests a fresh token from Google
- Injects the token into the form
- Submits the form with the valid token
This solves the common "token expired" issue, especially with AJAX/PJAX forms where users may take longer to fill out the form.
Getting reCAPTCHA v3 Keys
- Go to Google reCAPTCHA Admin
- Register a new site
- Choose reCAPTCHA v3
- Add your domains
- Copy the Site Key and Secret Key
Important: reCAPTCHA v3 keys are different from v2 keys. Make sure you select v3 when creating your keys.
License
MIT License