PHPackages                             sarav/laravel-multiauth - 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. sarav/laravel-multiauth

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

sarav/laravel-multiauth
=======================

A Simple Laravel Package for handling multiple authentication

0.0.7(10y ago)5030.7k↓25%8[1 issues](https://github.com/Sarav-S/Laravel-Multiauth/issues)MITPHPPHP &gt;=5.5.9

Since Nov 13Pushed 8y ago3 watchersCompare

[ Source](https://github.com/Sarav-S/Laravel-Multiauth)[ Packagist](https://packagist.org/packages/sarav/laravel-multiauth)[ RSS](/packages/sarav-laravel-multiauth/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)DependenciesVersions (8)Used By (0)

Laravel-Multiauth
=================

[](#laravel-multiauth)

[![Latest Stable Version](https://camo.githubusercontent.com/43d4a2823084ce12429d19c0bcd799e447f13b24fcb38b2fcc9b78c46580a8a5/68747470733a2f2f706f7365722e707567782e6f72672f73617261762f6c61726176656c2d6d756c7469617574682f762f737461626c65)](https://packagist.org/packages/sarav/laravel-multiauth) [![Total Downloads](https://camo.githubusercontent.com/01a47d3653b0b9a6172ba744db69b36a6bcf87fedf1ded9457542d66aa83e8fe/68747470733a2f2f706f7365722e707567782e6f72672f73617261762f6c61726176656c2d6d756c7469617574682f646f776e6c6f616473)](https://packagist.org/packages/sarav/laravel-multiauth) [![Latest Unstable Version](https://camo.githubusercontent.com/c6a2666c0f0028bd2c471caa9581c6146b5312e64d6608f384fe8a190bdb795f/68747470733a2f2f706f7365722e707567782e6f72672f73617261762f6c61726176656c2d6d756c7469617574682f762f756e737461626c65)](https://packagist.org/packages/sarav/laravel-multiauth) [![License](https://camo.githubusercontent.com/297b89ae67498a7f6c587c6023a325bc57fe5fe12ab15bb1b6a0fde4efc0e055/68747470733a2f2f706f7365722e707567782e6f72672f73617261762f6c61726176656c2d6d756c7469617574682f6c6963656e7365)](https://packagist.org/packages/sarav/laravel-multiauth)

A Simple Laravel Package for handling multiple authentication

- **Laravel**: 5.1.\*
- **Author**: Sarav
- **Author Homepage**:

Check working sample code of this project [here](https://github.com/Sarav-S/Laravel-Multiauth-SampleCode)

\##Step 1 : Require Composer package##

Open your terminal and navigate to your laravel folder. Now run the following command

```
composer require sarav/laravel-multiauth

```

or

```
"require": {
    "sarav/laravel-multiauth": "^0.0.7"
}

```

\##Step 2 : Replacing default auth service provider##

Replace "Illuminate\\Auth\\AuthServiceProvider::class" with "Sarav\\Multiauth\\MultiauthServiceProvider::class"

\##Step 3 : Modify auth.php##

Modify auth.php file from the config directory to something like this

```
'multi' => [
    'user' => [
        'driver' => 'eloquent',
        'model'  => App\User::class,
        'table'  => 'users'
    ],
    'admin' => [
        'driver' => 'eloquent',
        'model'  => App\Admin::class,
        'table'  => 'admins'
    ]
 ],

```

Note : I have set second user as admin here. Feel free to change yours but don't forget to add its respective driver, model and table.

We are done! Now you can simply login user/admin like the following code

```
\Auth::loginUsingId("user", 1); // Login user with id 1

\Auth::loginUsingId("admin", 1); // Login user with id 1

// Attempts to login user with email id johndoe@gmail.com
\Auth::attempt("user", ['email' => 'johndoe@gmail.com', 'password' => 'password']);

// Attempts to login admin with email id johndoe@gmail.com
\Auth::attempt("admin", ['email' => 'johndoe@gmail.com', 'password' => 'password']);

```

Simply pass the first parameter as key which you have configured in auth.php to perform authentication for either user or admin.

\##Improved Guard Class##

Now you can pass Guard class easily through nice "with" function.

```
$auth = $auth->with('admin');

```

For more information [check out this article](http://sarav.co/blog/multiple-authentication-in-laravel-5-1-continued/).

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.2% 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 ~7 days

Total

7

Last Release

3792d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4213743a962523f29e9114f324ddaa9b7f9901b5008ff8d69d2d2d911ea42ca8?d=identicon)[Sarav](/maintainers/Sarav)

---

Top Contributors

[![Sarav-S](https://avatars.githubusercontent.com/u/3178230?v=4)](https://github.com/Sarav-S "Sarav-S (25 commits)")[![francistm](https://avatars.githubusercontent.com/u/1118725?v=4)](https://github.com/francistm "francistm (1 commits)")

---

Tags

laravelauthAuthenticationuserloginlaravel 5multisigninmultiauthmultiple

### Embed Badge

![Health badge](/badges/sarav-laravel-multiauth/health.svg)

```
[![Health](https://phpackages.com/badges/sarav-laravel-multiauth/health.svg)](https://phpackages.com/packages/sarav-laravel-multiauth)
```

###  Alternatives

[auth0/login

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

2745.0M3](/packages/auth0-login)[panique/php-login

A full-feature user authentication / login system embedded into a simple but powerful MVC framework structure

2.2k1.2k](/packages/panique-php-login)[mad-web/laravel-social-auth

Easy social auth integration with a lot of available providers

516.7k](/packages/mad-web-laravel-social-auth)

PHPackages © 2026

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