fizzka/phalcon-recaptcha 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

fizzka/phalcon-recaptcha

最新稳定版本:0.1.2

Composer 安装命令:

composer require fizzka/phalcon-recaptcha

包简介

Simple wrapper for google recaptcha for phalcon

README 文档

README

About

This is small component to provide Google Recaptcha functionality in Phalcon.

It uses phalcon DI. Be sure, you supply DI this correct recaptcha configuration.

Installation

Feel free to fork, clone this repo, or install via composer:

composer require fizzka/phalcon-recaptcha

Usage

There are 3 easy steps:

Step 1

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

$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:

$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:

//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

License

MIT

统计信息

  • 总下载量: 7.59k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 17
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 16
  • Watchers: 2
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-01-18