PHPackages                             sniper7kills/multimodelauth - 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. sniper7kills/multimodelauth

ActiveLibrary

sniper7kills/multimodelauth
===========================

Package to allow authentication via multiple models in Laravel

00PHP

Since Dec 26Pushed 6y ago1 watchersCompare

[ Source](https://github.com/sniper7kills/multimodelauth)[ Packagist](https://packagist.org/packages/sniper7kills/multimodelauth)[ RSS](/packages/sniper7kills-multimodelauth/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

MultiModelAuth
==============

[](#multimodelauth)

This package is designed to allow multiple models to be used for authentication in laravel without having to switch guards.

Notes
-----

[](#notes)

This package does not currently support passport authentication

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

[](#installation)

Via Composer `composer require sniper7kills\multimodelauth`

Setting up
----------

[](#setting-up)

### Config

[](#config)

In your config, create a new provider that uses the `multi-model` driver, and specify which models can be authenticated against.

**Note:** The models should be listed in the order that they should be checked.

```
    'providers' => [
        'multi-model' => [
            'driver' => 'multi-model',
            'models' => [App\User::class, App\Admin::class],
        ],
    ],
```

Then update your guard to use the new provider you created.

```
    'guards' => [
        'web' => [
            'driver' => 'session',
            'provider' => 'multi-model',
        ],
    ],
```

### Models

[](#models)

Update your models listed in the provider to use the `Sniper7Kills\MultiModelAuth\MultiModelAuthTrait` trait

```
use Sniper7Kills\MultiModelAuth\MultiModelAuthTrait;

class User extends Authenticatable
{
    use MultiModelAuthTrait;
}
```

### Migrations

[](#migrations)

Add the following line to your "user(s)" migration files

```
$table->string('auth_identifier')->nullable()->unique();
```

(This may not be required in future versions, and is currently present due to trying to integrate with laravel/passport)

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity34

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/4cc1e81955caf76eb7a6f442aa5a7ab9f1dc84d0ca246b2eb4f5f44c4ff50add?d=identicon)[sniper7kills](/maintainers/sniper7kills)

---

Top Contributors

[![sniper7kills](https://avatars.githubusercontent.com/u/5902574?v=4)](https://github.com/sniper7kills "sniper7kills (6 commits)")

### Embed Badge

![Health badge](/badges/sniper7kills-multimodelauth/health.svg)

```
[![Health](https://phpackages.com/badges/sniper7kills-multimodelauth/health.svg)](https://phpackages.com/packages/sniper7kills-multimodelauth)
```

PHPackages © 2026

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