PHP code example of johnstyle / google-authenticator
1. Go to this page and download the library: Download johnstyle/google-authenticator library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
johnstyle / google-authenticator example snippets
$google = new GoogleAuthenticator();
// Register application
echo $google->getQRCodeUrl('MyApplicationName');
// Save secret Key
$secretKey = $google->getSecretKey();
$google = new GoogleAuthenticator($secretKey);
// User submit code
$userSubmitCode = '';
// Verify Code
if ($google->verifyCode($userSubmitCode)) {
// OK
}