dapikk/ko7-recaptcha 问题修复 & 功能扩展

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

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

dapikk/ko7-recaptcha

最新稳定版本:1.1.1

Composer 安装命令:

composer require dapikk/ko7-recaptcha

包简介

Simple wrapper for Ko7even MVC for Google's reCAPTCHA library

README 文档

README

PHP workflow Required minimum PHP Version Required minimum Ko7even Version Required minimum Google/reCaptcha Version Github Issues

Simple wrapper for Google's reCAPTCHA library

A single class that allows you to add Google reCAPTCHA to your Ko7 forms. Code is very simple.

Installation

Direct download: Download the ZIP file and extract into your project. OR

composer require dapikk/ko7-recaptcha

Requires

  • PHP => 7.4
  • Ko7even => 3.3.8
  • Google/reCaptcha => 1.3.0

Usage

  1. First obtain the appropriate keys for the type of reCAPTCHA you wish to integrate for v2 at https://www.google.com/recaptcha/admin
  2. Copy config from MODPATH/recaptcha/config/recaptcha.php to APPATH/config/recaptcha.php
  3. Make needed changes to configuration array!
  4. Activate recaptcha module in bootstrap!

To activate module:

Kohana::modules([
...
    'recaptcha' => MODPATH . 'recaptcha',
...
]);

To initialize reCaptcha check form on Your page:

<?php echo Recaptcha::instance()->get_html(); ?>

Or if multiple captchas are needed on same page then to provide some unique ID with request:

<?php echo Recaptcha::instance()->get_html('uniqueid12345'); ?>

To check verification from POST:

<?php 
    $x = Recaptcha::instance()->check($_POST['g-recaptcha-response']);
    if($x == FALSE){
        echo __('Please resubmit Google reCaptcha check!');
    }else{
        echo __('Recaptcha check succeeded!!!!');
    } 
?>

Config

recaptcha.php

return array(
	'public_key'  => 'YOUR GOOGLE RECAPTCHA SITE KEY',
	'private_key' => 'YOUR GOOGLE RECAPTCHA SECRET KEY',
	'version' => 'v2', //version required - recommended is to use v2 as it is more secure!!!
	'rscore' => NULL, //Minimum score for safe actions, defaults to 0.5 and up - needed for Google reCaptcha version v3
        'theme' => 'light',
	'dlang' => 'en',
        'dsize' => 'normal',
);

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-18