承接 oh86/laravel-captcha-sms 相关项目开发

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

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

oh86/laravel-captcha-sms

最新稳定版本:v1.0.0

Composer 安装命令:

composer require oh86/laravel-captcha-sms

包简介

sms captcha for oh86/laravel-captcha

README 文档

README

一、安装

composer require oh86/laravel-captcha
composer require oh86/laravel-captcha-sms
# 可选项
# composer require tencentcloud/sms

二、配置 config/captcha.php

return [
    'default' => env('CAPTCHA_DEFAULT_DRIVER', 'sms'),

    // ...

    // 短信验证码
    'sms' => [
        'smsDriver' => 'tencentCloud',  // sms.drivers.xxx
        // 验证码配置
        'captcha' => [
            'characters' => ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
            'length' => 6,   // 验证码长度
            'expire' => 300, // 验证码有效期,单位为秒
            'maxAttempts' => 5, // 最大尝试次数
            'reuseable' => false, // 在有效期内是否可重用验证码
            'acquire_next_after' => 60, // 获取验证码的频率,单位秒
        ],
    ],
];

三、使用示例

use Oh86\Captcha\Facades\Captcha;

// demo1
$key = Captcha::driver('sms')->acquire(['phone' => '13800138000']);
/** @var bool */
$result = Captcha::driver('sms')->verify(['key' => $key, 'value' => '066611', 'phone' => '13800138000']);

// demo2
$key = Captcha::driver('sms')->acquire(['phone' => '13800138000', 'countryCode' => '86']);
/** @var bool */
$result = Captcha::driver('sms')->verify(['key' => $key, 'value' => '066611', 'phone' => '13800138000', 'countryCode' => '86']);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-11