wayhood / googleauthenticator
Google Authenticator 2-factor authentication
Installs: 106
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 1
Open Issues: 1
pkg:composer/wayhood/googleauthenticator
This package is auto-updated.
Last update: 2025-10-07 19:40:09 UTC
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'; }