ahorn/friendlycaptcha
Composer 安装命令:
composer require ahorn/friendlycaptcha
包简介
Form Element to integrate Friendly Captcha into the Flow Form Framework
README 文档
README
This package add a form element which integrates Friendly Captcha v2 verification to your form.
Please note: You need an Friendly Captcha account to use these package.
Prerequisites
The Friendly Captcha v2 must be activated. This must be done via the Friendly Captcha website.

Installation
The package can be installed via Composer.
$ composer require ahorn/friendlycaptcha
Update from v1
Change secretKey to apiKey
Configuration
You need to add your Site Key (siteKey) and API Key (apiKey) from you Friendly Captcha v2 account. You can specify the default widget language and when the widget should start solving the puzzle. Please have a look at the official Friendly Captcha Widget API if you need more informations.
Ahorn: FriendlyCaptcha: siteKey: 'add-you-site-key' apiKey: 'add-you-api-key' language: 'de' startVerification: 'auto' apiEndpoint: 'global' theme: 'auto'
language
Current status can be found at https://developer.friendlycaptcha.com/docs/v2/guides/localization
startVerification
- auto:
Defaultthe solver will start as soon as possible. This is recommended if the user will definitely be submitting the CAPTCHA solution (e.g. there is only one form on the page), this offers the best user experience. - focus: as soon as the form containing the widget fires the focusin event the solver starts, or when the user presses the start button in the widget. This is recommended for webpages where only few users will actually submit the form. This is the default.
- none: the solver only starts when the user presses the button or it is programatically started by calling start().
apiEndpoint
By default the widget fetches puzzles from https://global.frcapi.com/api/v2/captcha, which serves puzzles globally. As a premium service we offer an alternative endpoint that serves requests from datacenters in Germany only.
eu: Service requires a Friendly Captcha Advanced or Enterprise plan. Endpoint hosted in germanyglobal:Default. Global service served from all over the world.
theme
light: A light theme (default).dark: A dark "night mode" theme.auto:DefaultMatch the user's operating system or browser preference settings.
In production environment we strictly recommend to use environment variables to set the values.
Add form element with Neos.Form.Builder
Create a new form in Neos backend. Add the new Friendly Captcha form element to you form.
Language Support
The package supports language content dimensions and set the language of the widget based on the language dimension. At the moment the package support only 2 characters to identify the language.
Override Settings
You can override the following configurations in the node properties:
- Site Key
- Api Key
- Language of the Widget
- Verification start
- Api Endpoint (if you have premium services)
- theme
Error handling
We added some error codes for better error handling. If you see an error code in the frontend it is most likely to be an configuration error.
- 1732156724: The X-API-Key header or apiKey not set.
- 5786245981: The apiKey is invalid.
- 7956325875: Sitekey is invalid.
- 1380742851: An unknown error has occurred. Check the settings.
Neos Fusion Form
process { content = afx` <Neos.Fusion.Form:FieldContainer field.name="captcha"> <Ahorn.FriendlyCaptcha:Fusion.Captcha /> </Neos.Fusion.Form:FieldContainer> ` schema { captcha = ${Form.Schema.string().validator('Ahorn.FriendlyCaptcha:FriendlyCaptcha')} } }
or use options to set API Key
'apiKey' => [null, 'Override API key', 'string', false],
'siteKey' => [null, 'Override site key', 'string', false],
'apiEndpoint' => [null, 'Override endpoint: global|eu|us', 'string', false],
set in the schema
schema { captcha = ${Form.Schema.string().validator('Ahorn.FriendlyCaptcha:FriendlyCaptcha',{ siteKey: 'override-siteKey', apiKey: 'override-apiKey', apiEndpoint: 'global' })} }
ahorn/friendlycaptcha 适用场景与选型建议
ahorn/friendlycaptcha 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10.42k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 07 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ahorn/friendlycaptcha 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ahorn/friendlycaptcha 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 10.42k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2022-07-27

