Simple php class for generating public key and one-time password (TOTP) for two factor authentication
require("class.tfa.php");
$tfa = new tfa();
$pubkey = $tfa->getPubKey();
print $pubkey; // Example: RADV RKNM KOV3 Q22A
Store public key on the server with the user account and use it in TOTP generators like Google Authenticator or Pebble's QuickAuth.
$pubkey = 'RADV RKNM KOV3 Q22A'; // Saved or given public key
$otp = $tfa->getOtp($pubkey);
print $otp; // Example: 194074
Use it to compare with TOTP generated on the other device.