承接 laercionunesc/captcha-cf 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

laercionunesc/captcha-cf

最新稳定版本:v1.0.0

Composer 安装命令:

composer require laercionunesc/captcha-cf

包简介

Easily use Turnstile Cloudflare plugin for CakePHP

README 文档

README

Installation

You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

composer require laercionunesc/captcha-cf

followed by the command:

composer update

Load plugin

From command line:

bin/cake plugin load CaptchaCf

OR load in config/bootstrap.php

Plugin::load('CaptchaCf', ['bootstrap' => false, 'autoload' => true]);

Load Component and Configure

Override default configure from loadComponent in Controller:

$this->loadComponent('CaptchaCf.CaptchaCf', [
    'enable' => true,
    'sitekey' => 'key-public', // get credentials in https://developers.cloudflare.com/turnstile/get-started/#existing-sites
    'secret' => 'key-secret',
    'size' => 'flexible',
    'theme' => 'auto',
    'language' => 'en'
]);

Usage

Display Captcha Turnstile in your view:

    <?= $this->Form->create() ?>
    <?= $this->Form->control('username') ?>
    <?= $this->Form->control('password') ?>
    <?= $this->CaptchaCf->display() ?>  // Display Captcha Turnstile 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 login()
    {
        if ($this->request->is('post')) {
            if ($this->CaptchaCf->verify()) { // if configure enable = false, it will always return true
                //do something here
            }
            $this->Flash->error(__('Please pass Turnstile first'));
        }
    }

Done!

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固