PHP code example of alexstack / google-recaptcha-to-any-form

1. Go to this page and download the library: Download alexstack/google-recaptcha-to-any-form 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/ */

    

alexstack / google-recaptcha-to-any-form example snippets


// For Google recaptcha v2
GoogleRecaptcha::show('SiteKey', 'Form_Field_ID');

// For Google recaptcha v3
GoogleRecaptcha::showV3('SiteKey', 'Form_Field_ID');

GoogleRecaptcha::verify('SecretKey');

composer 

use GoogleRecaptchaToAnyForm\GoogleRecaptcha;

GoogleRecaptcha::show($SiteKey, 'Form_ContactForm_Message', 'no_debug', 'mt-4 mb-1', 'Please tick the reCAPTCHA checkbox first!');

show($site_key,$after_field_id='Form_ContactForm_Comment', $debug='no_debug', $extra_class="mt-4 mb-4", $please_tick_msg="Please tick the I'm not robot checkbox");

GoogleRecaptcha::show($SiteKey, 'Form_Field_ID', 'no_debug','mb-2 invisible');

GoogleRecaptcha::show($SiteKey, 'Form_Field_ID', 'no_debug','show-inline-badge mt-4 mb-3','v3');
// or
GoogleRecaptcha::showV3($SiteKey, 'Form_Field_ID', 'no_debug');

use GoogleRecaptchaToAnyForm\GoogleRecaptcha;

GoogleRecaptcha::verify($GoogleRecaptchaSecretKey, 'Google Recaptcha Validation Failed!!');

verify($secret_key, $break_msg = null, $recaptcha_score=0.5)

GoogleRecaptcha::verify($SecretKey, 'Google Recaptcha Validation Failed!!', 0.36);

use GoogleRecaptchaToAnyForm\GoogleRecaptcha;

public function showGoogleRecaptcha()   {
    return GoogleRecaptcha::show($SiteKey, 'Form_ContactForm_Message', 'no_debug', 'mt-4 mb-1', 'Please tick the reCAPTCHA checkbox first!');
}

$showGoogleRecaptcha.RAW

GoogleRecaptcha::verify($GoogleRecaptchaSecretKey, 'Google Recaptcha Validation Failed!!');

use GoogleRecaptchaToAnyForm\GoogleRecaptcha;

public function showLoginForm()
{
    $showRecaptcha = GoogleRecaptcha::show('site_key', 'password', 'no_debug', 'mt-4 mb-3 col-md-6 offset-md-4', 'Please tick the reCAPTCHA checkbox first!');
    return view('auth.login', compact('showRecaptcha'));
}

{!! $showRecaptcha !!}

protected function validateLogin(Request $request)
{

    GoogleRecaptcha::verify('secret_key', 'Google Recaptcha Validation Failed!!');

    $request->validate([
        $this->username() => '


use GoogleRecaptchaToAnyForm\GoogleRecaptcha;

echo GoogleRecaptcha::show('site_key', 'input_2_3', 'no_debug', 'mt-4 mb-3 col-md-6 offset-md-4', 'Please tick the reCAPTCHA checkbox first!');


use GoogleRecaptchaToAnyForm\GoogleRecaptcha;

GoogleRecaptcha::verify('secret_key', 'Google Recaptcha Validation Failed!!');