PHP code example of adair-creative / recaptcha

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

    

adair-creative / recaptcha example snippets


protected function init() {
	...
	ReCAPTCHA::importJavascript();
	ReCAPTCHA::importCSS();
	...
}

public function __construct(ContentController $controller, string $name) {
	$fields = new FieldList([
		TextField::create("Message", "")
	]);

	ReCAPTCHA::addField($fields);

	return parent::__construct(
		$controller,
		$name,
		$fields,
		new FieldList([]),
		new FieldList([
		"Message"
		])
	);
}