PHPackages                             masoudghadimi/two-factor-auth - 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. masoudghadimi/two-factor-auth

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

masoudghadimi/two-factor-auth
=============================

Two factor authenticated for laravel-ui

v1.0-beta.3(5y ago)07MITPHP

Since Apr 9Pushed 5y ago1 watchersCompare

[ Source](https://github.com/masoudghadimi/twoFactorAuth)[ Packagist](https://packagist.org/packages/masoudghadimi/two-factor-auth)[ RSS](/packages/masoudghadimi-two-factor-auth/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

twoFactorAuth
=============

[](#twofactorauth)

Laravel Two-Factor Authenticated For **Laravel/Ui**

This package is being developed and debugged
============================================

[](#this-package-is-being-developed-and-debugged)

Install
-------

[](#install)

1. Install package - using composer

`composer require masoudghadimi/two-factor-auth`

2. Publish configuration file

`php artisan vendor:publish --tag=twoFactor`

3. Migration

`php artisan migrate`

4. Update User model (app/Models/User)

```
protected $fillable = [
     'name',
     'email',
     'password',
     'phone_number',
     'two_factor_type'
];
```

5. Add this codes to the User model (app/Models/User)

```
public function verifyCodes()
{
    return $this->hasMany(VerifyCode::class);
}
```

6. Add this codes to the LoginController (app/Http/Auth/LoginController)

```
use TwoFactorAuthenticate;

protected function authenticated(Request $request, $user)
{
     return $this->loggedIn($request , $user);
}
```

Configuration
-------------

[](#configuration)

Open configuration file - config/twoFactor.php

- Detect the channel
- change the route prefix
- Change the expiration time
- Change the number of digits in the code

### Next step

[](#next-step)

Create channel file and then put it in the config file (notificationsChannels)

**For example** :

create SmsVerifyCodeChannel.php in app/channels then enter your desired code as below

```
class SmsVerifyCodeChannel
{
    public function send($notifiable, Notification $notification)
    {
        if (! method_exists($notification , 'toSendVerifyCode')) {
            throw new \Exception('toSendVerifyCode not found');
        }

        $data = $notification->toSendVerifyCode($notifiable);

        $message = $data['message'];
        $phone = $data['number'];

        try{
            $lineNumber = 1111111;
            $api = new \Ghasedak\GhasedakApi('token');
            $api->SendSimple($phone, $message, $lineNumber);
        }
        catch(ApiException $e){
            echo $e->errorMessage();
        }
        catch(HttpException $e){
            echo $e->errorMessage();
        }
    }
}
```

Next, enter the config/twofactor.php file and in the **notificationsChannels** section, enter the created channel as follows:

```
'notificationsChannels' => \App\channels\SmsVerifyCodeChannel::class,
```

### Last step

[](#last-step)

Go to the link below :

`localhost:8000/home/security`

### Good luck

[](#good-luck)

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 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

1902d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2f5752d358156c2dbe18353705c8f11ed0da8eb25a2392da497ed1f534485609?d=identicon)[masoudghadimi](/maintainers/masoudghadimi)

---

Top Contributors

[![masoudghadimi](https://avatars.githubusercontent.com/u/61383198?v=4)](https://github.com/masoudghadimi "masoudghadimi (26 commits)")

---

Tags

laravel-two-factor-authlaravel8two-factor-authenticationtwofactorauthlaravelauthauthenticatetwoFacthor

### Embed Badge

![Health badge](/badges/masoudghadimi-two-factor-auth/health.svg)

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

###  Alternatives

[php-open-source-saver/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

83910.6M60](/packages/php-open-source-saver-jwt-auth)[directorytree/ldaprecord-laravel

LDAP Authentication &amp; Management for Laravel.

5742.2M17](/packages/directorytree-ldaprecord-laravel)[auth0/login

Auth0 Laravel SDK. Straight-forward and tested methods for implementing authentication, and accessing Auth0's Management API endpoints.

2745.2M3](/packages/auth0-login)[jurager/teams

Laravel package to manage team functionality and operate with user permissions.

23720.8k](/packages/jurager-teams)[azate/laravel-telegram-login-auth

Laravel Telegram Login Auth

3719.4k](/packages/azate-laravel-telegram-login-auth)

PHPackages © 2026

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