PHP code example of dutchcodingcompany / livewire-recaptcha
1. Go to this page and download the library: Download dutchcodingcompany/livewire-recaptcha library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
dutchcodingcompany / livewire-recaptcha example snippets
// V3 config:
'google' => [
'recaptcha' => [
'site_key' => env('GOOGLE_RECAPTCHA_SITE_KEY'),
'secret_key' => env('GOOGLE_RECAPTCHA_SECRET_KEY'),
'version' => 'v3',
'score' => 0.5, // An integer between 0 and 1, that indicates the minimum score to pass the Captcha challenge.
],
],
// V2 config:
'google' => [
'recaptcha' => [
'site_key' => env('GOOGLE_RECAPTCHA_SITE_KEY'),
'secret_key' => env('GOOGLE_RECAPTCHA_SECRET_KEY'),
'version' => 'v2',
'size' => 'normal', // 'normal', 'compact' or 'invisible'.
'theme' => 'light', // 'light' or 'dark'.
],
],
use Livewire\Component;
use DutchCodingCompany\LivewireRecaptcha\ValidatesRecaptcha;
class SomeComponent extends Component
{
// (optional) Set a response property on your component.
// If not given, the `gRecaptchaResponse` property is dynamically assigned.
public string $gRecaptchaResponse;
#[ValidatesRecaptcha]
public function save(): mixed
{
// Your logic here will only be called if the captcha passes...
}
}