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

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

autoluminescent/multiauth
=========================

Laravel Dynamic Authentication

v0.2(7y ago)329MITPHP

Since Feb 24Pushed 7y ago1 watchersCompare

[ Source](https://github.com/bardh7/multiauth)[ Packagist](https://packagist.org/packages/autoluminescent/multiauth)[ RSS](/packages/autoluminescent-multiauth/feed)WikiDiscussions master Synced 5mo ago

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

Laravel Multi-Auth
==================

[](#laravel-multi-auth)

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

[](#introduction)

Laravel Dynamic Auth is a package that allows you to create multiple guards dynamically.

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

[](#installation)

To install Multi-Auth, require it via Composer:

```
composer require autoluminescent/multiauth
```

Once Composer is done, run the following command:

```
php artisan multiauth:install
```

Guards are handled based on defined guards on `config/multiauth.php` and first URI segment. If the match is found, we set the Auth Default driver to the ‘matched guard’, else we set the default driver to ‘web’.

By default, `config/multiauth.php` ships with ‘web’ and ‘admin’ guards.

### Web guard

[](#web-guard)

The ‘web’ guard is considered as a default or a fallback guard, when no other matches are found/defined. It is pretty much like Laravel's default auth guard.

Default ‘web’ auth routes are as following:

-
-
-
-
-

To use the ‘web’ guard, all you have to do is add web.auth middleware to your Controllers or Routes.

### Admin guard

[](#admin-guard)

Admin is just an example guard that how you can add other guards. You can add as many guards as you want.

Routes for the admin guard are as following:

-
-
-
-
-

Multiauth will set default guard to 'admin' for all routes with ‘admin’ prefix.

To use the admin guard, all you have to do is add admin.auth middleware to your Controllers or Routes

Multiauth Config
----------------

[](#multiauth-config)

The config contains a basic explanation on how to setup guards. The domain key in guards is basicly the identifier that will match against the first segment of the URI. So if the domain is set to 'admin' then all routes with the 'admin' prefix will load the 'admin' guard.

```
