PHPackages                             dev-techguy/laravel-multiple-guards - 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. dev-techguy/laravel-multiple-guards

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

dev-techguy/laravel-multiple-guards
===================================

This library helps one to handle multiple guards. Read through the read me.

v1.1.9(3y ago)21.2k12MITPHP

Since Aug 29Pushed 3y ago1 watchersCompare

[ Source](https://github.com/dev-techguy/laravel-multiple-guards)[ Packagist](https://packagist.org/packages/dev-techguy/laravel-multiple-guards)[ RSS](/packages/dev-techguy-laravel-multiple-guards/feed)WikiDiscussions master Synced 1mo ago

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

[![](https://github.com/dev-techguy/TechGuy/raw/master/techguy.png)](https://v-ososi.site/)

[](#)

 **Big Things, Start Small**
 [ ![](https://camo.githubusercontent.com/5e0e20918080dc5c3fa8bf7ca357f24520d7bac0ad8692229875a71b6ba3d231/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6465762d746563686775792f6c61726176656c2d6d756c7469706c652d6775617264732e737667) ](https://github.com/dev-techguy/laravel-multiple-guards/issues) [ ![](https://camo.githubusercontent.com/6f19ce73dfc6553be0db801ececbfa7f7a8560c54d2ca32dba9ab6d4d415ca84/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f6465762d746563686775792f6c61726176656c2d6d756c7469706c652d6775617264732e737667) ](https://github.com/dev-techguy/laravel-multiple-guards/network/members) [ ![](https://camo.githubusercontent.com/d1faaac7c1654282aeea08f376c06fe638115acc5a207ac82ceb29726b9d0756/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6465762d746563686775792f6c61726176656c2d6d756c7469706c652d6775617264732e737667) ](https://github.com/dev-techguy/laravel-multiple-guards/stargazers) [ ![](https://camo.githubusercontent.com/40123a3d14bfc43c2298798c18f75eedb39b7e733ba38d76476d878c0777764b/68747470733a2f2f706f7365722e707567782e6f72672f6465762d746563686775792f6c61726176656c2d6d756c7469706c652d6775617264732f762f737461626c65) ](https://packagist.org/packages/dev-techguy/laravel-multiple-guards) [ ![](https://camo.githubusercontent.com/2e286923ab4f0a3908dbc6cf79d399f02c7dd9a037cabb566a50675e0d5ee374/68747470733a2f2f706f7365722e707567782e6f72672f6465762d746563686775792f6c61726176656c2d6d756c7469706c652d6775617264732f646f776e6c6f616473) ](https://packagist.org/packages/dev-techguy/laravel-multiple-guards)

 [![](https://camo.githubusercontent.com/b8fa3a9c387aed094f882406e330d9a0d58d780151425219d904835073d0a54e/68747470733a2f2f63646e2e6c796e64612e636f6d2f636f757273652f3739383439362f3739383439362d3633373331333839383839303636323735332d313678392e6a7067)](https://camo.githubusercontent.com/b8fa3a9c387aed094f882406e330d9a0d58d780151425219d904835073d0a54e/68747470733a2f2f63646e2e6c796e64612e636f6d2f636f757273652f3739383439362f3739383439362d3633373331333839383839303636323735332d313678392e6a7067)

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

[](#introduction)

This library helps one to handle multiple guards. Read through to understand how to use it.

Installing
----------

[](#installing)

The recommended way to install laravel-multiple-guards is through [Composer](http://getcomposer.org).

```
# Install package via composer
composer require dev-techguy/laravel-multiple-guards
```

Next, run the Composer command to install the latest stable version of *dev-techguy/laravel-multiple-guards*:

```
# Update package via composer
 composer update dev-techguy/laravel-multiple-guards --lock
```

After installing, the package will be auto discovered, But if need you may run:

```
# run for auto discovery
composer dump-autoload
```

Then run this, to get the *config/laravel-multiple-guards.php* for your own configurations:

```
# run this to get the configuration file at config/laravel-multiple-guards.php
php artisan vendor:publish --provider="LaravelMultipleGuards\LaravelMultipleGuardsServiceProvider"
```

A *config/laravel-multiple-guards.php* file will be created, follow the example below to define your guards.

```
# set all the guards to use within the system
SYSTEM_GUARDS=admin,web
```

Usage
-----

[](#usage)

Follow the steps below on how to use the laravel-multiple-guards:

#### How to use the Library

[](#how-to-use-the-library)

How to use the guards within your controller...

```
class HomeController extends Controller
{
    use FindGuard;

        /**
         * Create a new controller instance.
         *
         * @return void
         */
        public function __construct()
        {
            $this->middleware($this->setGuardMiddleware()); //@todo this sets the middleware automatically i.e auth, auth:admin that you have defined in the config/auth.php
        }

        /**
         * Show the application dashboard.
         *
         * @return Renderable
         */
        public function index()
        {
            return view('home');
        }

        /**
         * get authenticated user
         */
        public function getUser()
        {
            return $this->findGuardType()->user();
        }

        /**
         * logout user
         * @return RedirectResponse
         */
        public function logout()
        {
            $this->findGuardType()->logout();
            return redirect()->route('login');
        }
}

/**
 * How to get the guard name
 * authorized
*/
 return $this->findGuardType(true); //@todo this returns the guard name i.e web , admin
```

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

[](#version-guidance)

VersionStatusPackagistNamespaceRepo1.xLatest`dev-techguy/laravel-multiple-guards``LaravelMultipleGuards`[v1.1.6](https://github.com/dev-techguy/laravel-multiple-guards/releases/tag/v1.1.6)Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

For any security vulnerabilities, please email to [Vincent Ososi](mailto:vincent@shiftech.co.ke).

License
-------

[](#license)

This package is open-source, licensed under the [MIT License](https://opensource.org/licenses/MIT).

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

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

Recently: every ~212 days

Total

21

Last Release

1179d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e3eb77101c156056b3f28161aa60d2f8acbe665ccef40a5f4701eeb06902cc01?d=identicon)[dev-techguy](/maintainers/dev-techguy)

---

Top Contributors

[![general-oisebe](https://avatars.githubusercontent.com/u/154009443?v=4)](https://github.com/general-oisebe "general-oisebe (38 commits)")[![dev-techguy](https://avatars.githubusercontent.com/u/36882600?v=4)](https://github.com/dev-techguy "dev-techguy (4 commits)")

---

Tags

laravelAuthenticationmultipleguards

### Embed Badge

![Health badge](/badges/dev-techguy-laravel-multiple-guards/health.svg)

```
[![Health](https://phpackages.com/badges/dev-techguy-laravel-multiple-guards/health.svg)](https://phpackages.com/packages/dev-techguy-laravel-multiple-guards)
```

###  Alternatives

[tymon/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

11.5k49.1M350](/packages/tymon-jwt-auth)[php-open-source-saver/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

8359.8M53](/packages/php-open-source-saver-jwt-auth)[laragear/two-factor

On-premises 2FA Authentication for out-of-the-box.

339785.3k8](/packages/laragear-two-factor)[olssonm/l5-very-basic-auth

Laravel stateless HTTP basic auth without the need for a database

1662.5M1](/packages/olssonm-l5-very-basic-auth)[andrewdwallo/filament-companies

A comprehensive Laravel authentication and authorization system designed for Filament, focusing on multi-tenant company management.

34450.0k2](/packages/andrewdwallo-filament-companies)[sarav/laravel-multiauth

A Simple Laravel Package for handling multiple authentication

5030.7k](/packages/sarav-laravel-multiauth)

PHPackages © 2026

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