PHP code example of worksome / laravel-mfa

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

    

worksome / laravel-mfa example snippets


return [

    'user' => \App\Models\User::class,

    'channels' => [

        \Worksome\MultiFactorAuth\Enums\Channel::Email->value => [
            'driver' => env('MFA_EMAIL_DRIVER', 'null'),
        ],

        \Worksome\MultiFactorAuth\Enums\Channel::Sms->value => [
            'driver' => env('MFA_SMS_DRIVER', 'null'),
        ],

        \Worksome\MultiFactorAuth\Enums\Channel::Totp->value => [
            'driver' => env('MFA_TOTP_DRIVER', 'null'),
        ],

    ],
    
    // ...

];

$twoFactorAuth = new \Worksome\MultiFactorAuth\MultiFactorAuth();
$response = $twoFactorAuth->sms->make(
    new \Worksome\MultiFactorAuth\DataValues\Sms\E164PhoneNumber('+14155552671'),
);

dd($response);
bash
php artisan vendor:publish --tag="mfa-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="mfa-config"