1. Go to this page and download the library: Download imseyed/auth2fa 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/ */
imseyed / auth2fa example snippets
$totp = imseyed\Auth2FA::TOTP($secret, $timeSlice);
/*
$totp is a OPT code like: 458905
*/
$expirationTime = imseyed\Auth2FA::expire_time($timeSlice);
echo "Expire on ".date("H:i:s", $expirationTime)." (".($expirationTime - time())."s remind)";
/*
$expirationTime is a unix timestamp like: 1722929683
*/