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

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

shiftechafrica/laravel-multiple-guards
======================================

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

v2.0.3(2mo ago)074MITPHP

Since Aug 29Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/SHIFTECH-AFRICA/laravel-multiple-guards)[ Packagist](https://packagist.org/packages/shiftechafrica/laravel-multiple-guards)[ RSS](/packages/shiftechafrica-laravel-multiple-guards/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (1)Dependencies (2)Versions (26)Used By (0)

[![](https://github.com/SHIFTECH-AFRICA/avatars/raw/main/Secure.png?raw=true)](https://github.com/SHIFTECH-AFRICA)

[](#)

 **Big Things, Start Small**
 [ ![](https://camo.githubusercontent.com/66f282ffaa9cd2f87059a7e5d513c98a20b260c0dd5ad8326ddfc26c3df3f8ff/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f53484946544543482d4146524943412f6c61726176656c2d6d756c7469706c652d6775617264732e737667) ](https://github.com/SHIFTECH-AFRICA/laravel-multiple-guards/issues) [ ![](https://camo.githubusercontent.com/7f488ebf8e60054e4065aa76a7cbd62a52375b21e77e73650189e280a2c594eb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f53484946544543482d4146524943412f6c61726176656c2d6d756c7469706c652d6775617264732e737667) ](https://github.com/SHIFTECH-AFRICA/laravel-multiple-guards/network/members) [ ![](https://camo.githubusercontent.com/307a5c3741e25fdfc3e14f17c1f02ca2f12e41dbd00f1bbb4cdc441277f56672/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f53484946544543482d4146524943412f6c61726176656c2d6d756c7469706c652d6775617264732e737667) ](https://github.com/SHIFTECH-AFRICA/laravel-multiple-guards/stargazers) [ ![](https://camo.githubusercontent.com/87ae63937b7dce582a17a8decfe3ecc0964576c6333220ae9c147d5d0616cf68/68747470733a2f2f706f7365722e707567782e6f72672f73686966746563686166726963612f6c61726176656c2d6d756c7469706c652d6775617264732f762f737461626c65) ](https://packagist.org/packages/shiftechafrica/laravel-multiple-guards) [ ![](https://camo.githubusercontent.com/bb256a4d33b643aa60979fa250ac84b070335b974fcada9d185f9768bb253fda/68747470733a2f2f706f7365722e707567782e6f72672f73686966746563686166726963612f6c61726176656c2d6d756c7469706c652d6775617264732f646f776e6c6f616473) ](https://packagist.org/packages/shiftechafrica/laravel-multiple-guards)

 [![](https://raw.githubusercontent.com/SHIFTECH-AFRICA/avatars/0d9c91fd61777ba4d79d7008e38729dc4ec410fd/laravel.min.svg)](https://raw.githubusercontent.com/SHIFTECH-AFRICA/avatars/0d9c91fd61777ba4d79d7008e38729dc4ec410fd/laravel.min.svg)

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 shiftechafrica/laravel-multiple-guards
```

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

```
# Update package via composer
 composer update shiftechafrica/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.xEOL`shiftechafrica/laravel-multiple-guards``LaravelMultipleGuards`[v1.1.9](https://github.com/SHIFTECH-AFRICA/laravel-multiple-guards/releases/tag/v1.1.9)2.xLatest`shiftechafrica/laravel-multiple-guards``LaravelMultipleGuards`[v2.0.1](https://github.com/SHIFTECH-AFRICA/laravel-multiple-guards/releases/tag/v2.0.1)Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

For any security vulnerabilities, please email to [Support](mailto:bugs@shiftech.co.ke).

License
-------

[](#license)

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

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance85

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

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

Recently: every ~285 days

Total

24

Last Release

78d ago

Major Versions

v1.1.9 → v2.0.02024-07-09

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/60717528?v=4)[Shift Technologies Africa](/maintainers/shiftechafrica)[@shiftechafrica](https://github.com/shiftechafrica)

---

Top Contributors

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

---

Tags

laravelAuthenticationlivewiremultipleguardsmultiple guards

### Embed Badge

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

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

###  Alternatives

[auth0/login

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

2745.2M3](/packages/auth0-login)[olssonm/l5-very-basic-auth

Laravel stateless HTTP basic auth without the need for a database

1662.6M3](/packages/olssonm-l5-very-basic-auth)[hasinhayder/tyro

Tyro - The ultimate Authentication, Authorization, and Role &amp; Privilege Management solution for Laravel 12 &amp; 13

6753.6k5](/packages/hasinhayder-tyro)[alajusticia/laravel-logins

Session management in Laravel apps, user notifications on new access, support for multiple separate remember tokens, IP geolocation, User-Agent parser

2013.2k](/packages/alajusticia-laravel-logins)

PHPackages © 2026

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