PHPackages                             cube-agency/nova-google2fa - 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. cube-agency/nova-google2fa

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

cube-agency/nova-google2fa
==========================

This package provides Google2FA to Laravel Nova.

1.1.4(2y ago)891.8k↑25.7%13MITPHPPHP &gt;=8.1.0

Since Sep 2Pushed 1y ago3 watchersCompare

[ Source](https://github.com/cube-agency/nova-google2fa)[ Packagist](https://packagist.org/packages/cube-agency/nova-google2fa)[ RSS](/packages/cube-agency-nova-google2fa/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (6)Dependencies (3)Versions (7)Used By (0)

cube-agency/nova-google2fa
--------------------------

[](#cube-agencynova-google2fa)

This package enforces 2FA for Laravel Nova.

Flow
----

[](#flow)

### Activation

[](#activation)

- User gets recovery codes.

[![Recovery codes](docs/images/setup.png)](docs/images/setup.png)

- User activates 2FA on his device.

[![Activate 2FA](docs/images/register.png)](docs/images/register.png)

### Verification

[](#verification)

- User verifies login with 2FA.

[![Enter 2FA](docs/images/authenticate.png)](docs/images/authenticate.png)

### Recovery

[](#recovery)

- If user enters invalid code, recovery button is shown.

[![Enter 2FA](docs/images/authenticate-error.png)](docs/images/authenticate-error.png)

- User enters recovery code.

[![Enter 2FA](docs/images/authenticate-using-recovery.png)](docs/images/authenticate-using-recovery.png)

- User is logged in and can choose to reset two-factor auth via their Nova user resource.

[![Enter 2FA](docs/images/reset.png)](docs/images/reset.png)

- Add ability for User to reset their two-factor auth

```
     Text::make('Reset two-factor auth', function () {
                if (auth()->id() === $this->id) {
                    $route = route('nova.google2fa.destroy');
                    $buttonText = __('nova-google2fa::2fa-auth.actions.reset');

                    return "
                            {$buttonText}";
                }
            })->asHtml(),
```

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

[](#installation)

Install via composer

```
$ composer require cube-agency/nova-google2fa
```

Publish config and migrations

```
$ php artisan vendor:publish --provider="CubeAgency\NovaGoogle2fa\ToolServiceProvider"
```

Run migrations

> Note: Make sure you adjust config values according to your project before running migrations to avoid errors.

```
$ php artisan migrate
```

Use trait `use CubeAgency\NovaGoogle2fa\Traits\HasGoogle2fa;` within your User model to add 2FA relation

or

Add relation to User model manually

```
use CubeAgency\NovaGoogle2fa\Models\User2fa;
use Illuminate\Database\Eloquent\Relations\HasOne;
...

/**
 * @return HasOne
 */
public function user2fa(): HasOne
{
    return $this->hasOne(User2fa::class, 'user_id');
}
```

Add middleware to `nova.config`.

```
[
    ...
    'middleware' => [
        ...
        \CubeAgency\NovaGoogle2fa\Http\Middleware\Google2fa::class,
        ...
    ],
]
```

Config
------

[](#config)

```
return [
    /**
     * Disable or enable middleware.
     */
    'enabled' => env('GOOGLE_2FA_ENABLED', true),

    'models' => [
        /**
         * Change this variable to path to user model.
         */
        'user'    => 'App\User',

        /**
         * Change this if you need a custom connector
         */
        'user2fa' => User2fa::class,
    ],
    'tables' => [
        /**
         * Table in which users are stored.
         */
        'user' => 'users',
    ],

    'recovery_codes' => [
        /**
         * Number of recovery codes that will be generated.
         */
        'count'             => 8,

        /**
         * Number of blocks in each recovery code.
         */
        'blocks'            => 3,

        /**
         * Number of characters in each block in recovery code.
         */
        'chars_in_block'    => 16,
    ],

    'recovery_input' => 'recovery_code',

    'app_store_links' => [
        'android' => 'https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2&hl=en&gl=US',
        'ios' => 'https://apps.apple.com/lv/app/google-authenticator/id388497605',
    ]
];
```

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Every ~86 days

Recently: every ~73 days

Total

6

Last Release

969d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/37236345?v=4)[o8scure](/maintainers/o8scure)[@o8scure](https://github.com/o8scure)

---

Top Contributors

[![miks](https://avatars.githubusercontent.com/u/686243?v=4)](https://github.com/miks "miks (4 commits)")[![worldhck](https://avatars.githubusercontent.com/u/58777274?v=4)](https://github.com/worldhck "worldhck (2 commits)")[![bilaliqbalr](https://avatars.githubusercontent.com/u/4525426?v=4)](https://github.com/bilaliqbalr "bilaliqbalr (1 commits)")[![cliche23](https://avatars.githubusercontent.com/u/3168975?v=4)](https://github.com/cliche23 "cliche23 (1 commits)")[![dp-cube](https://avatars.githubusercontent.com/u/199728766?v=4)](https://github.com/dp-cube "dp-cube (1 commits)")[![ghgeorgiev-2create](https://avatars.githubusercontent.com/u/122776689?v=4)](https://github.com/ghgeorgiev-2create "ghgeorgiev-2create (1 commits)")

---

Tags

laravelnova

### Embed Badge

![Health badge](/badges/cube-agency-nova-google2fa/health.svg)

```
[![Health](https://phpackages.com/badges/cube-agency-nova-google2fa/health.svg)](https://phpackages.com/packages/cube-agency-nova-google2fa)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[jeffgreco13/filament-breezy

A custom package for Filament with login flow, profile and teams support.

1.0k2.1M58](/packages/jeffgreco13-filament-breezy)[stephenjude/filament-two-factor-authentication

Filament Two Factor Authentication: Google 2FA + Passkey Authentication

84215.9k9](/packages/stephenjude-filament-two-factor-authentication)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[visanduma/nova-two-factor

Nova Two Factor Authentication

58665.0k](/packages/visanduma-nova-two-factor)[lifeonscreen/nova-google2fa

This package provides Google2FA to Laravel Nova.

2488.6k](/packages/lifeonscreen-nova-google2fa)

PHPackages © 2026

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