2017 © Pedro Peláez
 

library recaptcha

PHP Library to verify google reCaptcha challenge

image

devstrefa/recaptcha

PHP Library to verify google reCaptcha challenge

  • Saturday, March 26, 2016
  • by Cichy
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

ReCaptcha 1.0.0

Build Status, (*1)

Simple PHP Library, designed for verifications of Google reCaptcha., (*2)

Why ?

Simple answer for this question is "I really don't know" :) but seriously, it is very simple project ideal for learning several PHP-Development tools, and if this library could be usefull for someone else that's great., (*3)

How to install

Library is compatible with composer so You can install it by adding:, (*4)

"require": {
        "devstrefa/recaptcha": "1.0.x-dev"
    }

to Your composer.json file, (*5)

You can also download zip file and include all necessery files by yourself, (*6)

How to use package

After installing / downloading package you can use it in very simple way. First of all if you are not using Composer autoloader (or any PSR-4 compatible loader) You should be sure that You include all necessery files, after that it's very simple., (*7)

Before you start integrate reCaptcha on your site visit reCaptcha Page and generate pair of keys, You can do this by clicking get reCaptch button., (*8)

Next add to your html file in <head> section:, (*9)

<script src='https://www.google.com/recaptcha/api.js'></script>

after that insert this code in place where you want to display your captcha widget (it must be inside \, (*10)

\

tags), (*11)

<div class="g-recaptcha" data-sitekey="place_your_public_key_here"></div>

Now when you refresh page you should see reCaptcha widget, if it's working You can go now to PHP part, (*12)

Whole code is really simple:, (*13)

<?php

use \DevStrefa\ReCaptcha\ReCaptcha;
use \DevStrefa\ReCaptcha\Senders\FgcSender;

$reCaptcha = new ReCaptcha('secret_key_here', new FgcSender());
$reCaptcha->setResponse($_POST['g-recaptcha-response']);
$response=$reCaptcha->verify();

if ($response->isSuccess())
{
    echo 'OK';
}
else
{ 
    echo 'Error';
}   

That's it! For more informations about library please check included example, and read genereated documentation., (*14)

ToDo

  • More Senders (Curl etc.)

Changelog

You can see Changelog for this project here, (*15)

License

Whole code in this repository is Under MIT license, (*16)

The Versions

26/03 2016

dev-develop

dev-develop https://github.com/DevStrefa/ReCaptcha

PHP Library to verify google reCaptcha challenge

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

The Development Requires

by Avatar Cichy

spam recaptcha google captcha

26/03 2016

dev-master

9999999-dev https://github.com/DevStrefa/ReCaptcha

PHP Library to verify google reCaptcha challenge

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

The Development Requires

by Avatar Cichy

spam recaptcha google captcha

26/03 2016

1.0.0

1.0.0.0 https://github.com/google/recaptcha/

PHP Library to verify google reCaptcha challenge

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

The Development Requires

by Avatar Cichy

spam recaptcha google captcha