2017 © Pedro Peláez
 

library phalcon-recaptcha

Simple wrapper for google recaptcha for phalcon

image

fizzka/phalcon-recaptcha

Simple wrapper for google recaptcha for phalcon

  • Wednesday, January 10, 2018
  • by fizzka
  • Repository
  • 2 Watchers
  • 12 Stars
  • 2,570 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 2 Open issues
  • 5 Versions
  • 8 % Grown

The README.md

phalcon-recaptcha

About

This is small component to provide Google Recaptcha functionality in Phalcon., (*1)

It uses phalcon DI. Be sure, you supply DI this correct recaptcha configuration., (*2)

Installation

Feel free to fork, clone this repo, or install via composer:, (*3)

composer require fizzka/phalcon-recaptcha

Usage

There are 3 easy steps:, (*4)

Step 1

Setup up config & di (or ensure, you did this at application bootstrap ;) :, (*5)

$config = new Phalcon\Config(array(
    "recaptcha" => array(
        'publicKey' => '[...your pub key goes here...]',
        'secretKey' => '[...your priv key goes here...]',
        'jsApiUrl' => 'https://www.google.com/recaptcha/api.js',
        'verifyUrl' => 'https://www.google.com/recaptcha/api/siteverify',
    )
));

$di = new Phalcon\DI\FactoryDefault();
$di->set('config', $config);

Step 2

Create form and add recaptcha on it:, (*6)

$form = new Phalcon\Forms\Form;
$form->setDI($di);

$recaptcha = new Fizz\Phalcon\Recaptcha('recaptcha');
$recaptcha->addValidator(new Fizz\Phalcon\RecaptchaValidator(array(
    'message' => "Are you human? (custom message)"
)));

$form->add($recaptcha);

Step 3

Validate form after submission:, (*7)

//submitted data, ex
$post = array(
    'g_recaptcha_response' => 'abzfoobar'
);

if ($form->isValid($post)) {
    echo 'ok';
} else {
    print_r($form->getMessages());
}

Code example

Full-working example @see example.php, (*8)

License

MIT, (*9)

The Versions

10/01 2018

dev-drone

dev-drone

Simple wrapper for google recaptcha for phalcon

  Sources   Download

MIT

by Avatar fizzka

recaptcha phalcon form element

17/04 2015

dev-master

9999999-dev

Simple wrapper for google recaptcha for phalcon

  Sources   Download

MIT

by Avatar fizzka

recaptcha phalcon form element

17/04 2015

0.1.2

0.1.2.0

Simple wrapper for google recaptcha for phalcon

  Sources   Download

MIT

by Avatar fizzka

recaptcha phalcon form element

07/02 2015

0.1.1

0.1.1.0

Simple wrapper for google recaptcha for phalcon

  Sources   Download

MIT

by Avatar fizzka

recaptcha phalcon form element

18/01 2015

0.1

0.1.0.0

Simple wrapper for google recaptcha for phalcon

  Sources   Download

MIT

by Avatar fizzka

recaptcha phalcon form element