robole/sulu-form-captcha-bundle
Composer 安装命令:
composer require robole/sulu-form-captcha-bundle
包简介
Extension for SuluFormBundle that adds third-party captcha providers
README 文档
README
SuluFormCaptchaBundle
Extension for SuluFormBundle that adds third-party captcha providers.
Installation
This bundle requires PHP 8.2 or later.
- Open a command console, enter your project directory and run:
composer require robole/sulu-form-captcha-bundle
If not automagically done, add the bundle to your config/bundles.php file:
return [ //... Robole\SuluFormCaptchaBundle\SuluFormCaptchaBundle::class => ['all' => true], ];
- Install and configure one or mutiple captcha providers from below. Once installed, each provider can be selected in the Sulu form editor.
Use with Cloudflare Turnstile
composer require pixelopen/cloudflare-turnstile-bundle
Then, enable the bundle by adding it to the list of registered bundles in the config/bundles.php file of your project:
return [ //... PixelOpen\CloudflareTurnstileBundle\PixelOpenCloudflareTurnstileBundle::class => ['all' => true] ];
- Visit Cloudfare, create a site key and secret key, save the keys to
.envand link via service configuration inconfig/packages/pixel_open_cloudlflare_turnstile.yaml:
pixel_open_cloudflare_turnstile: key: "%env(TURNSTILE_KEY)%" secret: "%env(TURNSTILE_SECRET)%"
For more information, refer to the bundle repository.
Use with Gregwar Captcha
- Install Gregwar CaptchaBundle:
composer require gregwar/captcha-bundle
Then, enable the bundle by adding it to the list of registered bundles in the config/bundles.php file of your project:
return [ //... Gregwar\CaptchaBundle\GregwarCaptchaBundle::class => ['all' => true] ];
- Customize the global bundle configuration in
config/packages/gregwar_captcha.yaml:
gregwar_captcha: width: 160 height: 50
For more information on configuration and form theming, refer to the bundle repository.
Use with Friendly Captcha
Attention: This bundle currently only supports Friendly Captcha v1!
- Install CORS Friendly Captcha Bundle:
composer require cors/friendly-captcha-bundle
Then, enable the bundle by adding it to the list of registered bundles in the config/bundles.php file of your project:
return [ //... CORS\Bundle\FriendlyCaptchaBundle\CORSFriendlyCaptchaBundle::class => ['all' => true], ];
- Visit Friendly Captcha, create a site key and secret key, save the keys to
.envand link via service configuration inconfig/packages/cors_friendly_captcha.yaml:
cors_friendly_captcha: sitekey: "%env(FRIENDLY_SITEKEY)%" secret: "%env(FRIENDLY_SECRET)%" use_eu_endpoints: true
- Import the widget via npm in your application or load from CDN, e.g. in
base.html.twig:
<script type="module" src="https://cdn.jsdelivr.net/npm/friendly-challenge@0.9.18/widget.module.min.js" async defer ></script> <script nomodule src="https://cdn.jsdelivr.net/npm/friendly-challenge@0.9.18/widget.min.js" async defer ></script>
For more information, refer to the bundle repository.
Use with ALTCHA
- Install AltchaBundle:
composer require tito10047/altcha-bundle
Then, enable the bundle by adding it to the list of registered bundles in the config/bundles.php file of your project:
return [ //... Tito10047\AltchaBundle\AltchaBundle::class => ['all' => true] ];
- Configure AltchaBundle as described in the README.md.
Theming
This bundle provides a minimal theme.html.twig which extends @SuluForm/themes/basic.html.twig. Use it like this:
<body> {% if content.form %} {% if app.request.get('send') != 'true' %} {% form_theme content.form '@SuluFormCaptcha/theme.html.twig' %} {{ form(content.form) }} {% else %} {{ view.form.entity.successText|raw }} {% endif %} {% endif %} </body>
To customize the default blocks (or to customize the default blocks provided by SuluFormBundle), extend @SuluFormCaptcha/theme.html.twig similar as described in SuluFormBundle theming.md.
Scripts
-
To check the coding standards, run:
composer php-cs
-
To apply coding standards, run:
composer php-cs-fix
robole/sulu-form-captcha-bundle 适用场景与选型建议
robole/sulu-form-captcha-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 341 次下载、GitHub Stars 达 7, 最近一次更新时间为 2025 年 02 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 robole/sulu-form-captcha-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 robole/sulu-form-captcha-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 341
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-02-17