zoneroot/recaptcha

Simple recaptcha class

dev-master 2015-01-17 00:24 UTC

This package is not auto-updated.

Last update: 2025-04-26 19:24:02 UTC


README

Simple recaptcha static php class.

Installation

With composer :

"zoneroot/recaptcha": "dev-master"

Usage

First you need to init the recaptcha with your keys :

use \zoneroot\recaptcha\recaptcha;
recaptcha::init("public key", "private key");

Then in your head tag insert :

echo recaptcha::script()

Next in your form tag insert :

echo recaptcha::html()

Finally you must check if the captcha is valid :

try {
	recaptcha::check()
	echo "Captcha is valid";
} 
catch (\zoneroot\recaptcha\exceptions\invalidRecaptchaException $e) {
	echo $e->getMessage();
}
catch (\zoneroot\recaptcha\exceptions\connectionException $e) {
	echo $e->getMessage();
}

Contributing

For contributing just follow the code style.

Todo

Add some comment

####Inspired by grafikart