PHP code example of nakipelo / orchid-2fa-totp

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

    

nakipelo / orchid-2fa-totp example snippets


// config/orchid-2fa.php
'channels' => [
    'allowed' => ['totp'],
    // ...
],

use Nakipelo\Orchid2FATotp\TotpChannel;

public function boot(): void
{
    TotpChannel::issuerUsing(fn ($user) => config('app.name').' ('.$user->tenant->name.')');
    TotpChannel::labelUsing(fn ($user) => $user->name);
}
bash
php artisan vendor:publish --tag=orchid-2fa-totp-config        # config/orchid-2fa-totp.php
php artisan vendor:publish --tag=orchid-2fa-totp-migrations    # database/migrations
php artisan vendor:publish --tag=orchid-2fa-totp-views         # resources/views/vendor/orchid-2fa-totp/enroll.blade.php
php artisan vendor:publish --tag=orchid-2fa-totp-translations  # lang/vendor/orchid-2fa-totp/{en,ru}/messages.php
bash
   php artisan migrate:reset --path=vendor/nakipelo/orchid-2fa-totp/database/migrations
   
bash
DB_CONNECTION=pgsql DB_HOST=127.0.0.1 DB_DATABASE=orchid_2fa_totp DB_USERNAME=postgres DB_PASSWORD=postgres \
  vendor/bin/pest tests/Feature/ReplayTest.php tests/Feature/ResetTest.php tests/Feature/VerificationTest.php