1. Go to this page and download the library: Download nocksapp/google2fa 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/ */
nocksapp / google2fa example snippets
use PragmaRX\Google2FA\Google2FA;
$google2fa = new Google2FA();
return $google2fa->generateSecretKey();
<div class="visible-print text-center">
{!! QrCode::size(100)->generate($google2fa->getQRCodeUrl($companyName, $companyEmail, $secretKey)); !!}
<p>Scan me to return to the original page.</p>
</div>
$secret = $request->input('secret');
$window = 8; // 8 keys (respectively 4 minutes) past and future
$valid = $google2fa->verifyKey($user->google2fa_secret, $secret, $window);