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


use MincDev\OtpAuth\OtpAuthenticator;

$otp = new OtpAuthenticator();

// Store the secret securely for the user.
$secret = $otp->newSecret();

$qrCode = $otp->getQR(
    '[email protected]',
    'My Awesome App',
    $secret
);

use MincDev\OtpAuth\OtpAuthenticator;

$otp = new OtpAuthenticator();

$isValid = $otp->validate($secret, $userEnteredCode);
bash
composer