PHPackages                             hesto/multi-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. hesto/multi-auth

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

hesto/multi-auth
================

Multi Auth for Laravel

v2.0.0(8y ago)449483.7k↓15.1%143[45 issues](https://github.com/Hesto/multi-auth/issues)[3 PRs](https://github.com/Hesto/multi-auth/pulls)MITPHPPHP &gt;=5.5.0

Since Aug 30Pushed 6y ago37 watchersCompare

[ Source](https://github.com/Hesto/multi-auth)[ Packagist](https://packagist.org/packages/hesto/multi-auth)[ RSS](/packages/hesto-multi-auth/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (1)Versions (15)Used By (0)

Hesto MultiAuth for Laravel 5.3, 5.4, 5.5, 5.6, 5.7 (see version guidance)
==========================================================================

[](#hesto-multiauth-for-laravel-53-54-55-56-57-see-version-guidance)

- `php artisan multi-auth:install {guard} -f`
- `php artisan multi-auth:install {guard} -f --domain`
- `php artisan multi-auth:install {guard} {service} -f --lucid`

Version Guidance
----------------

[](#version-guidance)

VersionLaravel versionStatusBranchInstall1.x5.3 and 5.4EOL1.0composer require hesto/multi-auth 1.\*2.x5.5, 5.6, 5.7Latest2.0composer require hesto/multi-authWhat it does?
-------------

[](#what-it-does)

With one simple command you can setup multi auth for your Laravel project. The package installs:

- Model
- Migration
- Controllers
- Notification
- Routes
    - routes/web.php
        - {guard}/login
        - {guard}/register
        - {guard}/logout
        - Password Reset Routes
            - {guard}/password/reset
            - {guard}/password/email
    - routes/{guard}.php
        - {guard}/home
- Middleware
- Views
- Guard
- Provider
- Password Broker
- Settings

Usage
-----

[](#usage)

### Step 1: Install Through Composer

[](#step-1-install-through-composer)

```
composer require hesto/multi-auth

```

### Step 2: Add the Service Provider (only for laravel lower than 5.5)

[](#step-2-add-the-service-provider-only-for-laravel-lower-than-55)

You'll only want to use these package for local development, so you don't want to update the production `providers` array in `config/app.php`. Instead, add the provider in `app/Providers/AppServiceProvider.php`, like so:

```
public function register()
{
	if ($this->app->environment() == 'local') {
		$this->app->register('Hesto\MultiAuth\MultiAuthServiceProvider');
	}
}
```

### Step 3: Install Multi-Auth files in your project

[](#step-3-install-multi-auth-files-in-your-project)

```
php artisan multi-auth:install {singular_lowercase_name_of_guard} -f

// Examples
php artisan multi-auth:install admin -f
php artisan multi-auth:install employee -f
php artisan multi-auth:install customer -f

```

Notice: If you don't provide `-f` flag, it will not work. It is a protection against accidental activation.

Alternative:

If you want to install Multi-Auth files in a subdomain you must pass the option `--domain`.

```
php artisan multi-auth:install admin -f --domain
php artisan multi-auth:install employee -f --domain
php artisan multi-auth:install customer -f --domain

```

To be able to use this feature properly, you should add a key to your .env file:

```
APP_DOMAIN=yourdomain.com

```

This will allow us to use it in the routes file, prefixing it with the domain feature from Laravel routing system.

Using it like so: `['domain' => '{guard}.' . env('APP_DOMAIN')]`

### Step 4: Migrate new model table

[](#step-4-migrate-new-model-table)

```
php artisan migrate

```

### Step 5: Try it

[](#step-5-try-it)

Go to: `http://project_url/GuardName/login`

Example: `http://myproject.dev/customer/login`

Options
-------

[](#options)

If you don't want model and migration use `--model` flag.

```
php artisan multi-auth:install admin -f --model

```

If you don't want views use `--views` flag.

```
php artisan multi-auth:install admin -f --views

```

If you don't want routes in your `routes/web.php` file, use `--routes` flag.

```
php artisan multi-auth:install admin -f --routes

```

Note
----

[](#note)

If you want to change the redirect path for once your `guard` is logged out. Add and override the following method in your {GuardName}Auth\\LoginController:

```
/**
 * Get the path that we should redirect once logged out.
 * Adaptable to user needs.
 *
 * @return string
 */
public function logoutToPath() {
    return '/';
}
```

Files which are changed and added by this package
-------------------------------------------------

[](#files-which-are-changed-and-added-by-this-package)

- config/auth.php

    - Add guards, providers, passwords
- app/Http/Providers/RouteServiceProvider.php

    - Register routes
- app/Http/Kernel.php

    - Register middleware
- app/Http/Middleware/

    - Middleware for each guard
- app/Http/Controllers/{Guard}Auth/

    - New controllers
- app/{Guard}.php

    - New Model
- app/Notifications/{Guard}ResetPassword.php

    - Reset password notification
- database/migrations/

    - Migration for new model
- routes/web.php

    - Register routes
- routes/{guard}.php

    - Routes file for given guard
- resources/views/{guard}/

    - Views for given guard

Changelog
---------

[](#changelog)

### Note: Never install configurations with same guard again after installed new version of package. So if you already installed your `admin` guard, don't install it again after you update package to latest version.

[](#note-never-install-configurations-with-same-guard-again-after-installed-new-version-of-package-so-if-you-already-installed-your-admin-guard-dont-install-it-again-after-you-update-package-to-latest-version)

### v1.0.7

[](#v107)

- changed {guard}/logout route method from `get` to `post`
- added `{guard}.guest` middleware to redirect from login page if user is already logged in
- added home view after login

### v1.0.6

[](#v106)

- added `auth:{guard}` middleware to `app\Providers\RouteServiceProvider.php`. If you have installed multi-auth guard with old version add middleware manually:

```
Route::group([
    'middleware' => ['web', 'admin', 'auth:admin'], //you need to add the last middleware to array to fix it (version < v.1.0.6)
    'prefix' => 'admin',
    'as' => 'admin.',
    'namespace' => $this->namespace,
], function ($router) {
    require base_path('routes/admin.php');
});
```

### v1.0.5

[](#v105)

- composer.json fix

### v1.0.4

[](#v104)

- added name and prefix to route group configuration in `RouteServiceProvider`

```
Route::group([
    'prefix' => 'admin', //if you have older version of package ( < v1.0.4) add this line manually,
    'as' => 'admin.', //if you have older version of package ( < v1.0.4) add this line manually (the DOT at the end is important),
    'middleware' => ['web', 'admin'],
    'namespace' => $this->namespace,
], function ($router) {
    require base_path('routes/admin.php');
});
```

- Now you will be able to name your routes without adding guard's name to route name in your `routes/{guard}.php` and your routes will be named (its important)

```
//New way
Route::get('/home', function () { // name('home'); // http://your-project/admin/home

//Old way
Route::get('/admin/home', function () { // name('admin.home'); // http://your-project/admin/home
```

### v1.0.3

[](#v103)

- changed deafult auth's layout name from `app.blade.php` to `auth.blade.php`

Support on Beerpay
------------------

[](#support-on-beerpay)

Hey dude! Help me out for a couple of 🍻!

[![Beerpay](https://camo.githubusercontent.com/dc5ebe6eb282f615183c4b854f6f50cf5616164f0fe8b750fa25bab19d4e3a49/68747470733a2f2f626565727061792e696f2f486573746f2f6d756c74692d617574682f62616467652e7376673f7374796c653d626565722d737175617265)](https://beerpay.io/Hesto/multi-auth) [![Beerpay](https://camo.githubusercontent.com/cb39c73bcf0318b0da8463afb84f3b1cef7e036769c1919637c463a8fd73cede/68747470733a2f2f626565727061792e696f2f486573746f2f6d756c74692d617574682f6d616b652d776973682e7376673f7374796c653d666c61742d737175617265)](https://beerpay.io/Hesto/multi-auth?focus=wish)

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity58

Moderate usage in the ecosystem

Community27

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

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

Recently: every ~158 days

Total

14

Last Release

2814d ago

Major Versions

v1.0.10 → v2.0.02017-09-15

### Community

Maintainers

![](https://www.gravatar.com/avatar/585fea021c5d2840a3a843dd8bf6cc67942d0224c37acb3044de346eed3a18fc?d=identicon)[Hesto](/maintainers/Hesto)

---

Top Contributors

[![Hesto](https://avatars.githubusercontent.com/u/13649507?v=4)](https://github.com/Hesto "Hesto (117 commits)")[![zeroc0d3](https://avatars.githubusercontent.com/u/18413459?v=4)](https://github.com/zeroc0d3 "zeroc0d3 (3 commits)")[![ebbbang](https://avatars.githubusercontent.com/u/4510786?v=4)](https://github.com/ebbbang "ebbbang (2 commits)")[![samshameem](https://avatars.githubusercontent.com/u/16553215?v=4)](https://github.com/samshameem "samshameem (1 commits)")[![joseluisq](https://avatars.githubusercontent.com/u/1700322?v=4)](https://github.com/joseluisq "joseluisq (1 commits)")[![codepotato](https://avatars.githubusercontent.com/u/417524?v=4)](https://github.com/codepotato "codepotato (1 commits)")[![mikerodham](https://avatars.githubusercontent.com/u/7014362?v=4)](https://github.com/mikerodham "mikerodham (1 commits)")

---

Tags

laravelauthmulti

### Embed Badge

![Health badge](/badges/hesto-multi-auth/health.svg)

```
[![Health](https://phpackages.com/badges/hesto-multi-auth/health.svg)](https://phpackages.com/packages/hesto-multi-auth)
```

###  Alternatives

[ollieread/multiauth

Alternative auth system for Laravel

447141.1k1](/packages/ollieread-multiauth)[bmatovu/multi-auth

Laravel Multi Authentication

18325.2k](/packages/bmatovu-multi-auth)[sarav/laravel-multiauth

A Simple Laravel Package for handling multiple authentication

5530.9k](/packages/sarav-laravel-multiauth)[orchestra/auth

Auth Component for Orchestra Platform

23108.7k3](/packages/orchestra-auth)[ingria/laravel-x509-auth

Laravel 5 Client Certificate auth middleware

375.7k](/packages/ingria-laravel-x509-auth)

PHPackages © 2026

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