PHPackages                             ipunkt/laravel-two-factor-authentication - 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. ipunkt/laravel-two-factor-authentication

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

ipunkt/laravel-two-factor-authentication
========================================

Two factor authentication (2FA) with TOTP tokens. (RFC 6238)

1.0.0(8y ago)151MITPHPPHP &gt;=5.6.4

Since Dec 6Pushed 8y ago2 watchersCompare

[ Source](https://github.com/ipunkt/laravel-two-factor-authentication)[ Packagist](https://packagist.org/packages/ipunkt/laravel-two-factor-authentication)[ RSS](/packages/ipunkt-laravel-two-factor-authentication/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (3)Dependencies (8)Versions (4)Used By (0)

Two Factor Authentication
=========================

[](#two-factor-authentication)

[![Total Downloads](https://camo.githubusercontent.com/e08623cebfac73080665e40a806c33f61cbb5a9176b7b475983e7ebfd01336a7/68747470733a2f2f706f7365722e707567782e6f72672f6970756e6b742f6c61726176656c2d74776f2d666163746f722d61757468656e7469636174696f6e2f642f746f74616c2e737667)](https://packagist.org/packages/ipunkt/laravel-two-factor-authentication)[![Latest Stable Version](https://camo.githubusercontent.com/2b705f7a6c877d2423006448b641de8fe33ceff005536bd0fc4eb16dd22b2640/68747470733a2f2f706f7365722e707567782e6f72672f6970756e6b742f6c61726176656c2d74776f2d666163746f722d61757468656e7469636174696f6e2f762f737461626c652e737667)](https://packagist.org/packages/ipunkt/laravel-two-factor-authentication)[![Latest Unstable Version](https://camo.githubusercontent.com/27c37161799cc24ac085a757babd2e3f89a336b0b923ef95999efd19df3087c7/68747470733a2f2f706f7365722e707567782e6f72672f6970756e6b742f6c61726176656c2d74776f2d666163746f722d61757468656e7469636174696f6e2f762f756e737461626c652e737667)](https://packagist.org/packages/ipunkt/laravel-two-factor-authentication)[![License](https://camo.githubusercontent.com/9b333234fb443cc50474ca7fef1f866adc842d096d59b937f32e6ed585063fd5/68747470733a2f2f706f7365722e707567782e6f72672f6970756e6b742f6c61726176656c2d74776f2d666163746f722d61757468656e7469636174696f6e2f6c6963656e73652e737667)](https://packagist.org/packages/ipunkt/laravel-two-factor-authentication)

Introduction
------------

[](#introduction)

This package adds 2FA (Two Factor Authentication) to your laravel application.

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

[](#installation)

Just install the package by adding to composer requirements

```
composer require ipunkt/laravel-two-factor-authentication

```

and add the Service Provider in your `config/app.php`

```
\Ipunkt\Laravel\TwoFactorAuthentication\TwoFactorAuthenticationServiceProvider::class,

```

After adding the provider the database migration should run

```
php artisan migrate

```

Setup
-----

[](#setup)

### User Model Trait

[](#user-model-trait)

The package adds a `google2fa_secret` column to your users table. This can be null, but should hold the secret key, being generated with the help of a trait: `Ipunkt\Laravel\TwoFactorAuthentication\TwoFactorSupport`

This trait has to be added to the authorization based user model class.

### Authentication Controller

[](#authentication-controller)

The `Ipunkt\Laravel\TwoFactorAuthentication\AuthenticatesWith2FA` trait overrides the `authenticated` method within the `LoginController`. So please update your LoginController

```
use App\Http\Controllers\Controller;
use Ipunkt\Laravel\TwoFactorAuthentication\AuthenticatesWith2FA;
use Illuminate\Foundation\Auth\AuthenticatesUsers;

class LoginController extends Controller
{
	use AuthenticatesUsers,
            AuthenticatesWith2FA {
            AuthenticatesWith2FA::authenticated insteadof AuthenticatesUsers;
        }
	//...
}

```

So we can interact with the user after authenticating with user credentials and display a TOTP field to get the Authenticator App displayed One-Time-Token.

Customizing Package Content
---------------------------

[](#customizing-package-content)

### Config

[](#config)

You can change config settings by publishing config file

```
$> php artisan vendor:publish --provider="Ipunkt\Laravel\TwoFactorAuthentication\ServiceProvider" --tag=config

```

and edit `/config/2fa.php` to suit your needs.

### Views

[](#views)

You can change delivered views by publishing view files

```
$> php artisan vendor:publish --provider="Ipunkt\Laravel\TwoFactorAuthentication\ServiceProvider" --tag=view

```

and edit views in `/resources/views/vendor/2fa`.

### Migrations

[](#migrations)

You can change the packaged migrations by publishing migrations

```
$> php artisan vendor:publish --provider="Ipunkt\Laravel\TwoFactorAuthentication\ServiceProvider" --tag=migrations

```

and edit migrations in `/database/migrations`.

License
-------

[](#license)

Two Factor Authentication is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

Every ~165 days

Total

3

Last Release

3112d ago

Major Versions

0.1.1 → 1.0.02017-11-01

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4946056?v=4)[Robert Kummer](/maintainers/rokde)[@rokde](https://github.com/rokde)

---

Top Contributors

[![JuanLeadSupply](https://avatars.githubusercontent.com/u/26138256?v=4)](https://github.com/JuanLeadSupply "JuanLeadSupply (2 commits)")

---

Tags

laravelRFC 6238Authentication2fatwo-factor

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ipunkt-laravel-two-factor-authentication/health.svg)

```
[![Health](https://phpackages.com/badges/ipunkt-laravel-two-factor-authentication/health.svg)](https://phpackages.com/packages/ipunkt-laravel-two-factor-authentication)
```

###  Alternatives

[laragear/two-factor

On-premises 2FA Authentication for out-of-the-box.

339785.3k8](/packages/laragear-two-factor)[thecodework/two-factor-authentication

Two Factor Authentication (2FA) for Laravel

225.5k](/packages/thecodework-two-factor-authentication)[stephenjude/filament-two-factor-authentication

Filament Two Factor Authentication: Google 2FA + Passkey Authentication

81158.7k4](/packages/stephenjude-filament-two-factor-authentication)[alajusticia/laravel-logins

Session management in Laravel apps, user notifications on new access, support for multiple separate remember tokens, IP geolocation, User-Agent parser

2011.0k](/packages/alajusticia-laravel-logins)[sicaboy/laravel-mfa

A Laravel package of Multi-factor Authentication (MFA/2FA) with a middleware.

101.2k](/packages/sicaboy-laravel-mfa)

PHPackages © 2026

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