定制 jp3cki/totp 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

jp3cki/totp

最新稳定版本:v3.0.1

Composer 安装命令:

composer require jp3cki/totp

包简介

RFC 6238 / TOTP: Time-Based One-Time Password Algorithm

README 文档

README

PHP implementation of RFC6238 (TOTP: Time-Based One-Time Password Algorithm).

License Latest Stable Version CI

Requirements

  • PHP (64-bits): PHP 8.1 or later
  • PHP Extensions: hash

Install

  1. Set up Composer, the de facto standard package manager.
  2. php composer.phar require jp3cki/totp

Usage

<?php declare(strict_types=1); use jp3cki\totp\Totp; require_once('vendor/autoload.php'); // Generate new shared-secret key (for each user) $secret = Totp::generateKey(); echo "secret: {$secret}\n"; echo "\n"; // Make URI for importing from QRCode. $uri = Totp::createKeyUriForGoogleAuthenticator($secret, 'theuser@example.com', 'Issuer Name'); echo "uri: {$uri}\n"; echo "\n"; // Verify user input $userInput = '123456'; // $_POST['totp'] $isValid = Totp::verify($userInput, $secret, time()); var_dump($isValid);

License

The MIT License.

Copyright (c) 2015-2025 AIZAWA Hina <hina@fetus.jp>

Contributing

Patches and/or report issues are welcome.

  • Please create new branch for each issue or feature. (should not work in master branch)
  • Please write and run test. $ make test
  • Please run check-style for static code analysis and coding rule checking. $ make check-style
  • Please clean up commits.
  • Please create new pull-request for each issue or feature.
  • Please use Japanese or very simple English to create new pull-request or issue.

Breaking Changes

  • v3.0.0

    • Minimum environment is now PHP 8.1
  • v2.0.0

    • Minimum environment is now PHP 7.2
    • Argument types are now strictly enforced
    • Removed Random::generate*(). Always use random_bytes() now.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固