PHP code example of davmixcool / google-recaptcha

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

    

davmixcool / google-recaptcha example snippets


use Davmixcool\GoogleRecaptcha;
	
	//cha([
		'secret_key' => 'Your secret key',
		'site_key' => 'Your site key',
		'theme' => 'light'
	]);

	//Place the renderJs before the closing body tag.
	$googleRecaptcha->renderJs();

	//Place the renderCaptcha where you want to display the captcha.
	$googleRecaptcha->renderCaptcha();

	// Check if captcha was passed successfully 
	if ($googleRecaptcha->check()) {
	    // Perform success action

	} else {
	    // Throw an error if catcha was not solved successfully
	}