PHP code example of mincdev / php-otpauth
1. Go to this page and download the library: Download mincdev/php-otpauth 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/ */
mincdev / php-otpauth example snippets
$otpAuth = new OtpAuthenticator();
$userName = "MrDoe";
$appName = "My Awesome App";
// Store this secret somewhere safe, as you'll need it to validate the pin later
$userSecret = $otpAuth->newSecret();
$qrBase64 = $otpAuth->getQR($userName, $appName, $userSecret);
$otpAuth = new OtpAuthenticator();
$isValid = $otpAuth->validate($userSecret, $pinCode);
composer