ilbee / totp
基于时间的单次密码(TOTP)的PHP实现
2.1.0
2024-04-23 14:47 UTC
Requires
- php: 7.4 || ^8.1
- christian-riesen/base32: ^1.6
- symfony/security-bundle: ^5.4 || ^6.4 || ^7.1
Suggests
- endroid/qr-code-bundle: Enables you to generate TOTP URIs with QR codes
README
此项目是TOTP(基于时间的单次密码)算法的PHP实现。此库旨在与Symfony框架一起使用。
安装
您可以通过Composer安装此库
composer require ilbee/totp
使用
配置
您可以在创建实例时通过传递额外的选项来配置TOTP
<?php // ./src/Controller/UserController.php use Ilbee\Totp\Totp; $totp = new Totp([ 'digits' => 6, // Number of digits for the one-time password 'period' => 30, // Time period for which a password is valid (in seconds) 'algorithm' => 'sha1', // TOTP Hash algorithm ]);
贡献
欢迎贡献。请为任何贡献打开一个问题或提交一个拉取请求。
赞助
许可协议
此项目受MIT许可协议许可。有关更多详细信息,请参阅LICENSE文件。