fet/laminas-cloudflare-turnstile 问题修复 & 功能扩展

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

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

fet/laminas-cloudflare-turnstile

最新稳定版本:0.1.0

Composer 安装命令:

composer require fet/laminas-cloudflare-turnstile

包简介

An implementation of cloudflare turnstile for Laminas applications.

README 文档

README

The fet/laminas-cloudflare-turnstile package provides a Cloudflare turnstile widget integration for Laminas forms.

Installation

To install this package, use Composer:

composer require fet/laminas-cloudflare-turnstile

Enable the Fet\\LaminasCloudflareTurnstile module in your config/application.config.php file.

return [
    'modules' => [
        // ... other modules ...
        'Fet\\LaminasCloudflareTurnstile',
    ],
];

Usage

You can add the turnstile adapter via the captcha option to your form and render the element in your view.

Form

$form = new \Laminas\Form\Form('my-form');
$form->add([
    'name' => 'captcha',
    'type' => \Laminas\Form\Element\Captcha::class,
    'options' => [
        'captcha' => new \Fet\LaminasCloudflareTurnstile\TurnstileCaptcha([
            'site_key' => getenv('CLOUDFLARE_TURNSTILE_SITE_KEY'),
            'secret_key' => getenv('CLOUDFLARE_TURNSTILE_SECRET_KEY'),
        ]),
    ]
]);

View

<?= $this->form($this->form); ?>

<!-- or -->
<?= $this->formElement($this->form->get('captcha')); ?>
<?= $this->formElementErrors($this->form->get('captcha')); ?>

Tests

Run the tests with:

composer test

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-25