PHPackages                             devianl2/tenant-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. devianl2/tenant-auth

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

devianl2/tenant-auth
====================

Microservice auth package

1.0.16(4y ago)0113MITPHP

Since Jan 25Pushed 4y ago1 watchersCompare

[ Source](https://github.com/devianl2/tenant-auth)[ Packagist](https://packagist.org/packages/devianl2/tenant-auth)[ RSS](/packages/devianl2-tenant-auth/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (3)Versions (20)Used By (0)

Tenant Auth
===========

[](#tenant-auth)

Tenant auth is a laravel package that validate JWT token and its claim properties and set into request header

For each microservice development, you need to follow instruction below to ensure the application is standardize.

Step 1:
-------

[](#step-1)

Install from composer

```
composer require devianl2/tenant-auth
```

Run the following command for public key config

```
php artisan vendor:publish --provider="Tenant\Auth\TenantAuthProvider"
```

Step 2:
-------

[](#step-2)

To use this package, make sure any **API request** does have Authorization header and **Web request** does have Authorization key in cookie

Go to **App\\Http\\Middleware\\Kernel** and add the following syntax

```
 protected $middleware = [
        // \App\Http\Middleware\TrustHosts::class,
        \App\Http\Middleware\TrustProxies::class,
        ...
        **\Tenant\Auth\Middleware\TenantAuthMiddleware::class**
    ];
```

Step 3 (Optional:
-----------------

[](#step-3-optional)

If you are using in $routeMiddleware and define the middleware group by your own, you may do the following action:

Go to App\\Http\\Kernel to add your own route middleware like following:

```
protected $routeMiddleware = [
        .....
        'tenant-auth'   =>  \Tenant\Auth\Middleware\TenantAuthMiddleware::class
    ];
```

Go to App\\Http\\Middleware\\EncryptCookies and add Authorization into except array because Laravel Cookie has encrpytion for all values by default but the Authorization token encrpytion is not needed in this case since it was generated by gateway.

```
protected $except = [
        'Authorization'
    ];
```

Go to **App\\Http\\Middleware\\Kernel** and add the following syntax

```
 protected $middleware = [
        // \App\Http\Middleware\TrustHosts::class,
        \App\Http\Middleware\TrustProxies::class,
        ...
        **\Tenant\Auth\Middleware\TenantAuthMiddleware::class**
    ];
```

### Note:

[](#note)

This package will automatic extract the following information if JWT token is valid:

- x-user-uuid (Current user's uuid)
- x-tenant-uuid (Current user's tenant id)
- x-tenant-url (Current user's tenant url)
- x-scopes (Current user's permissions / json encoded)
- x-roles (Current user's roles. E.g: admin/users. / Json encoded)
- x-modules (Module that user could access / json encoded)

You may use $request to extract the information in controller E.g $request-&gt;header('x-user-uuid');

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

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

Total

19

Last Release

1542d ago

Major Versions

0.0.2 → 1.0.02022-02-08

### Community

Maintainers

![](https://www.gravatar.com/avatar/258988219cf511bbd9c2809a6ba1653006dee578e2db26cb813aa99f6a24a319?d=identicon)[devianl2](/maintainers/devianl2)

---

Top Contributors

[![devianl2](https://avatars.githubusercontent.com/u/23150573?v=4)](https://github.com/devianl2 "devianl2 (27 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/devianl2-tenant-auth/health.svg)

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

###  Alternatives

[jeremy379/laravel-openid-connect

OpenID Connect support to the PHP League's OAuth2 Server. Compatible with Laravel Passport.

59437.0k9](/packages/jeremy379-laravel-openid-connect)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

3417.0k](/packages/duncanmcclean-statamic-cargo)

PHPackages © 2026

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