PHP code example of fragotesac / zf1-2fa

1. Go to this page and download the library: Download fragotesac/zf1-2fa 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/ */

    

fragotesac / zf1-2fa example snippets


    $this->tfa = new \Zend\TwoFactorAuth();

    $this->tfa->setMailConfig([
        'transport' => [],      // Mail transport settings
        'subject'   => '',      // Email subject for 2FA codes
        'from'      => ['email' => '', 'name' => ''],  // Sender details
        'template'  => []       // Email template configuration
    ]);

    $this->tfa->init([$this, 'checkUser']);

   zfTwoFactorAuth.init(apiUrl, data, 'glass-theme', (loginFormData, url) => {
        // Handle the login callback here
   });