2017 © Pedro Peláez
 

library google-recaptcha

Library to simplify the server-side validation of Google's 'No CAPTCHA reCAPTCHA'

image

nietonfir/google-recaptcha

Library to simplify the server-side validation of Google's 'No CAPTCHA reCAPTCHA'

  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 7 Versions
  • 18 % Grown

The README.md

GoogleReCaptcha

ReCAPTCHA is a free CAPTCHA service that protect websites from spam and abuse. This library aims to providate an alternative to the official ReCAPTCHA library for verifying a users "No CAPTCHA reCAPTCHA" response. Internally it uses Guzzle for communicating with the ReCAPTCHA API., (*1)

Build Status Latest Stable Version Latest Unstable Version License, (*2)

Installation

The recommended way to install GoogleReCaptcha is through Composer., (*3)

# Install Composer
curl -sS https://getcomposer.org/installer | php

Next, run the Composer command to install the latest stable version of GoogleReCaptcha:, (*4)

composer require "nietonfir/google-recaptcha"

Or add GoogleReCaptcha in your composer.json, (*5)

"require": {
    "nietonfir/google-recaptcha": "~0.0"
}

and tell Composer to install the library:, (*6)

``` bash composer update "nietonfir/google-recaptcha", (*7)


After installing, you need to require Composer's autoloader: ```php require 'vendor/autoload.php';

Usage

A sample validation client could look like the following:, (*8)

use GuzzleHttp\Client;
use Nietonfir\Google\ReCaptcha\ReCaptcha;
use Nietonfir\Google\ReCaptcha\Api\RequestData,
    Nietonfir\Google\ReCaptcha\Api\ResponseFactory;

$requestData = new RequestData(
    'YOUR_API_SECRET_HERE',         // secret
    $_POST['g-recaptcha-response'], // user response
    $_SERVER['REMOTE_ADDR']         // end user IP
);

$reCaptcha = new ReCaptcha(new Client(), new ResponseFactory());
$response = $reCaptcha->processRequest($requestData);

if ($response->isValid()) {
    // check the hostname if "Domain Name Validation" is turned off
    // if($_SERVER['SERVER_NAME'] === $response->getHostName()) { … }
    echo 'I\'m not a robot';
} else {
    var_dump($response->getErrors());
}

The Versions

19/04 2017

dev-master

9999999-dev https://github.com/nietonfir/GoogleReCaptcha

Library to simplify the server-side validation of Google's 'No CAPTCHA reCAPTCHA'

  Sources   Download

MIT

The Requires

 

The Development Requires

security captcha google recaptcha no captcha recaptcha

19/04 2017

v0.2.1

0.2.1.0 https://github.com/nietonfir/GoogleReCaptcha

Library to simplify the server-side validation of Google's 'No CAPTCHA reCAPTCHA'

  Sources   Download

MIT

The Requires

 

The Development Requires

security captcha google recaptcha no captcha recaptcha

19/04 2017

v0.2.0

0.2.0.0 https://github.com/nietonfir/GoogleReCaptcha

Library to simplify the server-side validation of Google's 'No CAPTCHA reCAPTCHA'

  Sources   Download

MIT

The Requires

 

The Development Requires

security captcha google recaptcha no captcha recaptcha

09/04 2017

v0.1.0

0.1.0.0 https://github.com/nietonfir/GoogleReCaptcha

Library to simplify the server-side validation of Google's 'No CAPTCHA reCAPTCHA'

  Sources   Download

MIT

The Requires

 

The Development Requires

security captcha google recaptcha no captcha recaptcha

08/04 2017

v0.0.3

0.0.3.0 https://github.com/nietonfir/GoogleReCaptcha

Library to simplify the server-side validation of Google's 'No CAPTCHA reCAPTCHA'

  Sources   Download

MIT

The Requires

 

The Development Requires

security captcha google recaptcha no captcha recaptcha

01/01 2015

v0.0.2

0.0.2.0 https://github.com/nietonfir/GoogleReCaptcha

Library to simplify the server-side validation of Google's 'No CAPTCHA reCAPTCHA'

  Sources   Download

MIT

The Requires

 

The Development Requires

security captcha google recaptcha no captcha recaptcha

28/12 2014

v0.0.1

0.0.1.0 https://github.com/nietonfir/GoogleReCaptcha

Library to simplify the server-side validation of Google's 'No CAPTCHA reCAPTCHA'

  Sources   Download

MIT

The Requires

 

The Development Requires

security captcha google recaptcha no captcha recaptcha