定制 traw/powermailcaptcha 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

traw/powermailcaptcha

Composer 安装命令:

composer require traw/powermailcaptcha

包简介

powermailcaptcha - Captcha Extension for Powermail

README 文档

README

Captcha Extension for TYPO3 powermail to prevent spam

Dependencies

  • powermail >= 8.0
  • TYPO3 11 or 12

Installation

Just install this extension via composer composer require traw/powermailcaptcha

Google Recaptcha

  • Register your domain to www.google.com/recaptcha/
  • Works with reCAPTCHA, Version 2
  • Add sitekey and secretkey to TypoScript Constants (see example below)
  • In TypoScript Constants, set the captcha method to recaptcha (This is the default)

Friendly Captcha

  • Register your domain to friendlycaptcha.com
  • Add sitekey and secretkey to TypoScript Constants (see example below)
  • In TypoScript Constants, set the captcha method to friendlycaptcha

hCaptcha

  • Register your domain to hcaptcha.com
  • Add sitekey and secretkey to TypoScript Constants (see example below)
  • In TypoScript Constants, set the captcha method to hcaptcha

Cloudflare

  • Register your domain to cloudflare.com
  • Add sitekey and secretkey to TypoScript Constants (see example below)
  • In TypoScript Constants, set the captcha method to cloudflare

Prosopo Procaptcha

  • Register your domain to prosopo.io
  • Add sitekey and secretkey to TypoScript Constants (see example below)
  • In TypoScript Constants, set the captcha method to procaptcha

General

  • Ensure that spamshield is enabled (see below)
  • Add a field of Type Powermailcaptcha to your powermail form
  • Have fun

Example for TypoScript Constants:

plugin.tx_powermailcaptcha.captchaMethod = recaptcha
plugin.tx_powermailcaptcha.captchaMethod = friendlycaptcha
plugin.tx_powermailcaptcha.captchaMethod = hcaptcha
plugin.tx_powermailcaptcha.captchaMethod = cloudflare
plugin.tx_powermailcaptcha.captchaMethod = procaptcha
plugin.tx_powermailcaptcha.sitekey = 6LdsBBUTAAAAAKMhI67inzeAvzBh5JdRRxlCwbTz
plugin.tx_powermailcaptcha.secretkey = 6LdsBBUTAAAAAKMhaaaainzeAvzBh5JdRRxlCwbyy

Disable captcha

From versions >= 1.3.0

In case you wish to disable the captcha temporarily, just add the following line to your typoscript constants: plugin.tx_powermailcaptcha.enable = 0

You can also find this option in the Constant Editor.

Captcha Language

From Versions >=1.1.0

The current language is added to the captcha via language parameter which is taken from your Site Configuration.

To disable this behavior, add the following to your Typoscript Constants:

plugin.tx_powermailcaptcha.useSiteLanguage = 0

Depending on your website language, not all languages are supported for every Captcha-Method. Read

for further information on supported language codes.

Common pitfalls and best practice

spamshield must be enabled in powermail (TypoScript setup):

plugin.tx_powermail.settings.setup.spamshield._enable = 1

Keep up to date if powermail recognize spam (TypoScript setup):

# Get an email if spam was recognized
plugin.tx_powermail.settings.setup.spamshield.email = spamreceiver@yourdomain.de

# Write to a logfile when spam was recognized
plugin.tx_powermail.settings.setup.spamshield.logfileLocation = typo3temp/logs/powermailSpam.log

Remove the default captcha field by adding the following to your Page TSConfig: TCEFORM.tx_powermail_domain_model_field.type.removeItems = captcha

Breaking change - Upgrade from <1.5.0 to >=1.5.0

The typoscript has previously been automatically loaded in a Preset TypoScript setup file. However, this is no longer the case. In multisite environments where some websites dont use powermail the typoscript is not needed.
Also in some case it's hard to override settings which are made in a Preset TypoScript (for example: ext_typoscript_setup.typoscript).

Therefore, from version 1.5.0 and up the typoscript has to be manually added in your website's static template.

Upgrade from 1.0.x to >=1.1.x

If you override powermail's partial Partial/Form/Page.html in your own extension, make sure to add the variable languageIso to the f:render of the Fields.

e.g.

<f:render partial="Form/Field/{vh:String.Upper(string:field.type)}" arguments="{field:field, languageIso:languageIso}"/>

If you override powermail's FormController in your own extension, please see EXT:powermailcaptcha/Classes/Controller/FormController.php on how this extension adds the language variable.

Credits

This extension is based on EXT:powermailrecaptcha by einpraegsam.

Changelog

Version Date Description
2.2.0 2025-03-21 Feature: add PSR-14 event before the actual verify request
2.1.0 2024-09-25 Feature: add Prosopo Procaptcha captcha method
2.0.0 2024-07-31 Dropped support for TYPO3 11 and older powermail version
Version Date Description
1.8.0 2025-03-21 Feature: add PSR-14 event before the actual verify request
1.7.0 2024-09-25 Feature: add Prosopo Procaptcha captcha method
1.6.0 2024-04-24 Feature: add Cloudflare Turnstile captcha method
1.5.0 2024-04-24 Feature: add typoscript as a static template
1.3.0 2023-06-05 Feature: add option to disable frontend output
1.2.0 2023-06-02 Code Maintenance: simplifiy controller code
1.1.0 2023-05-11 Add option to force website language onto the Captcha
1.0.0 2022-10-18 Initial release

traw/powermailcaptcha 适用场景与选型建议

traw/powermailcaptcha 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 56.46k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2022 年 10 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「captcha」 「TYPO3 CMS」 「powermail」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 traw/powermailcaptcha 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 traw/powermailcaptcha 我们能提供哪些服务?
定制开发 / 二次开发

基于 traw/powermailcaptcha 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 3
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2022-10-18