PHPackages                             hxm/2fa - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. hxm/2fa

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

hxm/2fa
=======

A One Time Password Authentication package.

1.0.1(4y ago)19MITPHP

Since Oct 26Pushed 4y ago1 watchersCompare

[ Source](https://github.com/hoanxuanmai/2fa)[ Packagist](https://packagist.org/packages/hxm/2fa)[ RSS](/packages/hxm-2fa/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

2FA for Laravel
---------------

[](#2fa-for-laravel)

A One Time Password Authentication package.

Installation
------------

[](#installation)

1. This package publishes a config/hxm2fa.php file. If you already have a file by that name, you must rename or remove it.
2. You can install the package via composer:

    ```
    composer require hxm/2fa
    ```
3. Run the migrations:

    ```
    php artisan migrate
    ```
4. You should publish the template views and the config/hxm2fa.php config file with:

    ```
    php artisan vendor:publish --provider=HXM2FA\ServiceProvider
    ```

- Default config file contents

    ```
    // ...
    return [
        'enabled' => true,
        'show_secret' => false,
        'route' => [
            'prefix' => 'user'
        ],

        'extend_layout' => 'layouts.app',

        'encrypt_secret' => true,

        /*customer QR style*/
        'qr_code' => [
            'size' => 192,
            'margin' => 0,
            'background' => [
                'red' => 255, //red the red amount of the color, 0 to 255
                'green' => 255, //green the green amount of the color, 0 to 255
                'blue' => 255 //blue the blue amount of the color, 0 to 255
            ],
            'fill' => [
                'red' => 45, //red the red amount of the color, 0 to 255
                'green' => 55, //green the green amount of the color, 0 to 255
                'blue' => 72 //blue the blue amount of the color, 0 to 255
            ],
        ]
    ];
    ```

Basic Usage
-----------

[](#basic-usage)

- First, add the HXM2FA\\TwoFactorAuthenticatable trait to your User model(s):

    ```

    use Illuminate\Foundation\Auth\User as Authenticatable;
    use HXM2FA\TwoFactorAuthenticatable;

    class User extends Authenticatable
    {
      use TwoFactorAuthenticatable;

      // ...
    }

    ```
- We provide a Facede with static functions that perform useful functions:

    ```

    use HXM2FA\Facades\HXM2FA;

      // ...

      /*to generate Secret*/
      $secret = HXM2FA::generate2FASecret();

      /*to generate QrCode html*/
      HXM2FA::getQrCode(string $company, string $holder, string $secret)

      /*to verify code*/
      HXM2FA::verifyCode(string $secret, string $code)

      /*To get instance of \PragmaRX\Google2FA\Google2FA */
      HXM2FA::getGoogle2FA();

      // ...

    ```

Author
------

[](#author)

[HoanXuanMai](https://github.com/hoanxuanmai)

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1711d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/253837bebf61531c6bb369dad0dd5e54136bd557b6583f058301ad837d5fa8dc?d=identicon)[hoanxuanmai](/maintainers/hoanxuanmai)

---

Top Contributors

[![hoanxuanmai](https://avatars.githubusercontent.com/u/47692574?v=4)](https://github.com/hoanxuanmai "hoanxuanmai (3 commits)")

---

Tags

laravelAuthentication2faTwo Factor Authenticationgoogle2fahxm

### Embed Badge

![Health badge](/badges/hxm-2fa/health.svg)

```
[![Health](https://phpackages.com/badges/hxm-2fa/health.svg)](https://phpackages.com/packages/hxm-2fa)
```

###  Alternatives

[stephenjude/filament-two-factor-authentication

Filament Two Factor Authentication: Google 2FA + Passkey Authentication

84215.9k9](/packages/stephenjude-filament-two-factor-authentication)[statamic/cms

The Statamic CMS Core Package

4.8k3.6M984](/packages/statamic-cms)[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[pragmarx/google2fa-qrcode

QR Code package for Google2FA

12532.0M55](/packages/pragmarx-google2fa-qrcode)[hasinhayder/tyro-login

Tyro Login - Beautiful, customizable authentication views for Laravel 12 &amp; 13

2464.9k6](/packages/hasinhayder-tyro-login)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
