giginc/cakephp3-recaptcha
Composer 安装命令:
composer require giginc/cakephp3-recaptcha
包简介
Recaptcha for CakePHP 3
README 文档
README
Installation
You can install this plugin into your CakePHP application using composer.
The recommended way to install composer packages is:
composer require giginc/cakephp3-recaptcha
followed by the command:
composer update
Load plugin
From command line:
bin/cake plugin load Recaptcha
Load Component and Configure
Override default configure from loadComponent:
Recaptcha version2
$this->loadComponent('Recaptcha.Recaptcha', [
'enable' => true, // true/false
'version' => 2,
'sitekey' => 'your_site_key', //if you don't have, get one: https://www.google.com/recaptcha/intro/index.html
'secret' => 'your_secret',
'type' => 'image', // image/audio
'theme' => 'light', // light/dark
'lang' => 'vi', // default en
'size' => 'normal' // normal/compact
]);
Recaptcha version3
$this->loadComponent('Recaptcha.Recaptcha', [
'enable' => true, // true/false
'version' => 3,
'sitekey' => 'your_site_key', //if you don't have, get one: https://www.google.com/recaptcha/intro/index.html
'secret' => 'your_secret',
'scoreThreshold' => 0.5, // score threshold (default 0.5)
]);
Override default configure from app config file:
file: config/app.php
Recaptcha version2
/**
* Recaptcha configuration.
*
*/
'Recaptcha' => [
'enable' => true,
'version' => 2,
'sitekey' => 'your_site_key',
'secret' => 'your_secret',
'type' => 'image',
'theme' => 'light',
'lang' => 'es',
'size' => 'normal'
]
Recaptcha version3
/**
* Recaptcha configuration.
*
*/
'Recaptcha' => [
'enable' => true,
'version' => 3,
'sitekey' => 'your_site_key',
'secret' => 'your_secret',
]
Override default configure from recaptcha config file:
file: config/recaptcha.php
<?php
return [
/**
* Recaptcha configuration.
*
*/
'Recaptcha' => [
'enable' => true,
'version' => 3,
'sitekey' => 'your_site_key',
'secret' => 'your_secret',
]
];
Load recaptcha config file:
file: config/bootstrap.php
Configure::load('recaptcha', 'default', true);
Config preference:
- loadComponent config options
- recaptcha config file
- app config file
Usage
Display recaptcha in your view:
<?= $this->Form->create() ?>
<?= $this->Form->control('email') ?>
<?= $this->Recaptcha->display() ?> // Display recaptcha box in your view, if configure has enable = false, nothing will be displayed
<?= $this->Form->button() ?>
<?= $this->Form->end() ?>
Verify in your controller function
public function forgotPassword()
{
if ($this->request->is('post')) {
if ($this->Recaptcha->verify()) { // if configure enable = false, it will always return true
//do something here
}
$this->Flash->error(__('Please pass Google Recaptcha first'));
}
}
LICENSE
giginc/cakephp3-recaptcha 适用场景与选型建议
giginc/cakephp3-recaptcha 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.82k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「recaptcha」 「cakephp」 「google」 「cakephp-plugin」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 giginc/cakephp3-recaptcha 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 giginc/cakephp3-recaptcha 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 giginc/cakephp3-recaptcha 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CakePHP 4.x AdminLTE Theme.
Client library for reCAPTCHA with proxy support, a free service that protects websites from spam and abuse.
Diese Contao 4 Erweiterung stellt Google reCAPTCHA V2 in Form eines neuen Formularfeldes im Formulargenerator bereit. This extension provides Google reCAPTCHA V2 in the form of a new form field in the form generator of Contao Open Source CMS.
A simple and easy to use Google ReCaptcha v3 package for Laravel
Email Toolkit Plugin for CakePHP
Rhino, a CMS and Application-Framework plugin for CakePHP
统计信息
- 总下载量: 3.82k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-01-04