worksome/laravel-mfa

A driver-based multi-factor authentication package for Laravel
134,901 9
Install
composer require worksome/laravel-mfa
Latest Version:v0.3.0
PHP:^8.4
Laravel:12 · 13
Older releases:9 · 10 · 11
License:MIT
Last Updated:Apr 15, 2026
Links: GitHub  ·  Packagist
Maintainer: owenvoke

Laravel Multi-Factor Authentication

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A driver-based multi-factor authentication package for Laravel

Installation

You can install the package via composer:

composer require worksome/laravel-mfa

You can publish and run the migrations with:

php artisan vendor:publish --tag="mfa-migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="mfa-config"

This is the contents of the published config file:

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'),
        ],

    ],
    
    // ...

];

For the full configuration, see the config/mfa.php file.

Usage

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

dd($response);

The about command

This package adds information to the artisan about command. This information can be disabled by setting the mfa.features.about_command configuration to false.

Testing

composer test

Changelog

Please see GitHub Releases for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

Related Packages

worksome/envy

Automatically keep your .env files in sync.

2,075,809 688
worksome/exchange

Check Exchange Rates for any currency in Laravel.

681,882 126
worksome/company-info

Lookup company information

522,301 34
worksome/request-factories

Test Form Requests in Laravel without all of the boilerplate.

2,340,626 622
worksome/verify-by-phone

Verify your users by call or SMS

661,040 147

Version History

Version Released PHP Laravel License
v0.3.0 ^8.4 ^12.44|^13.0 MIT
v0.2.4 ^8.4 ^12.44|^13.0 MIT
v0.2.3 ^8.4 ^12.44 MIT
v0.2.2 ^8.3 ^11.0 || ^12.0 MIT
v0.2.1 ^8.2 ^10.0 || ^11.0 MIT