PHP code example of ericmann / totp

1. Go to this page and download the library: Download ericmann/totp 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/ */

    

ericmann / totp example snippets




// Create a new, random token
$token = new EAMann\TOTP\Key();

// Import a known token
$raw = '...';
$token = EAMann\TOTP\Key::import($raw);

// Validate an OTP against a token
if (EAMann\TOTP\is_valid_auth_code($token, $otp)) {
  // ...
}