wayhood/googleauthenticator
Composer 安装命令:
composer require wayhood/googleauthenticator
包简介
Google Authenticator 2-factor authentication
README 文档
README
Google Authenticator 2-factor authentication
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist wayhood/googleauthenticator "*"
or add
"wayhood/googleauthenticator": "*"
to the require section of your composer.json file.
Usage
Once the extension is installed, simply use it in your code by :
use wh/googleauthenticator/GoogleAuthenticator'; $ga = new GoogleAuthenticator(); $secret = $ga->createSecret(); echo "Secret is: ".$secret."\n\n"; $qrCodeUrl = $ga->getQRCodeGoogleUrl('Blog', $secret); echo "Google Charts URL for the QR-Code: ".$qrCodeUrl."\n\n"; $oneCode = $ga->getCode($secret); echo "Checking Code '$oneCode' and Secret '$secret':\n"; $checkResult = $ga->verifyCode($secret, $oneCode, 2); // 2 = 2*30sec clock tolerance if ($checkResult) { echo 'OK'; } else { echo 'FAILED'; }
统计信息
- 总下载量: 122
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-4-Clause
- 更新时间: 2014-12-01