PHPackages                             joaovdiasb/laravel-multi-tenancy - 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. joaovdiasb/laravel-multi-tenancy

AbandonedArchivedLibrary

joaovdiasb/laravel-multi-tenancy
================================

Laravel multi-tenancy package

0.2(2y ago)113033[1 PRs](https://github.com/joaovdiasb/laravel-multi-tenancy/pulls)MITPHPPHP ^7.4

Since Jun 13Pushed 2y ago2 watchersCompare

[ Source](https://github.com/joaovdiasb/laravel-multi-tenancy)[ Packagist](https://packagist.org/packages/joaovdiasb/laravel-multi-tenancy)[ RSS](/packages/joaovdiasb-laravel-multi-tenancy/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (3)Dependencies (8)Versions (5)Used By (0)

Laravel multi-tenancy databases
===============================

[](#laravel-multi-tenancy-databases)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)![CI](https://github.com/joaovdiasb/laravel-multi-tenancy/actions/workflows/run_tests.yml/badge.svg)[![Total Downloads](https://camo.githubusercontent.com/ce850c0c04589c04447ea57f8ea7e5bf38168dfaab83b7cc1def788be94c5992/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a6f616f7664696173622f6c61726176656c2d6d756c74692d74656e616e63792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/joaovdiasb/laravel-multi-tenancy)

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

[](#installation)

Install via composer

```
composer require joaovdiasb/laravel-multi-tenancy
```

Configuration
-------------

[](#configuration)

1. Publish provider and migrate:

```
php artisan vendor:publish --provider="Joaovdiasb\LaravelMultiTenancy\LaravelMultiTenancyServiceProvider" && php artisan migrate --path=./database/migrations/tenant
```

2. Add env variable `TENANT_ENCRYPT_KEY` with 32 random characters string.

Usage
-----

[](#usage)

1. Add middleware *multitenancy* on the routes that you need;
2. Send *X-Ref* header on request with tenant reference, defined on tenants table.

Commands
--------

[](#commands)

- Add tenant:

```
php artisan tenant:add {name?} {reference?} {db_name?} {db_user?} {db_password?} {db_host?} {db_port?}
```

> **{reference?}** Used to pass on request header to identify tenant

> All params are optional, if not present, will be asked on console

- Migrate tenant:

```
php artisan tenant:migrate {tenant?} {--fresh} {--seed}
```

> **{tenant?}** Select tenant by id, if not present, all tenants are selected

> **{--fresh}** Is present, will drop all tables from the database

> **{--seed}** Is present, call seeds

- Seed tenant:

```
php artisan tenant:seed {tenant?} {--class=*}
```

> **{tenant?}** Select tenant by id, if is not present, all tenants are selected

> **{--class=\*}** Is required, specify class name

- Backup tenant:

```
php artisan tenant:backup {tenant?}
```

> **{tenant?}** Select tenant by id, if is not present, all tenants are selected

Testing
-------

[](#testing)

Run the tests with:

```
vendor/bin/phpunit
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security-related issues, please email [j.v\_dias@hotmail.com](mailto:j.v_dias@hotmail.com) instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](/LICENSE.md) for more information.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity44

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 ~411 days

Total

3

Last Release

971d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/918d26fea3e34e45cb913df9d3d1eb5c67fc06a9ec58f4ca164a7eab73d586f9?d=identicon)[joaovdiasb](/maintainers/joaovdiasb)

---

Top Contributors

[![joaovdiasb](https://avatars.githubusercontent.com/u/51106311?v=4)](https://github.com/joaovdiasb "joaovdiasb (72 commits)")

---

Tags

laravellaravel-frameworklaravel-multi-tenancylaravel-packagemulti-tenancymulti-tenantmulti-tenantsmultitenancymultitenantsaastenancytenantlaravelsaasmulti-tenantmulti-tenancytenancy

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/joaovdiasb-laravel-multi-tenancy/health.svg)

```
[![Health](https://phpackages.com/badges/joaovdiasb-laravel-multi-tenancy/health.svg)](https://phpackages.com/packages/joaovdiasb-laravel-multi-tenancy)
```

###  Alternatives

[hyn/multi-tenant

Run multiple websites using the same laravel installation while keeping tenant specific data separated for fully independant multi-domain setups.

2.6k1.1M9](/packages/hyn-multi-tenant)[stancl/tenancy

Automatic multi-tenancy for your Laravel application.

4.3k6.6M40](/packages/stancl-tenancy)[tenancy/tenancy

Creating multi tenant saas from your Laravel app with ease

1.3k43.6k](/packages/tenancy-tenancy)[tenancy/framework

Creating multi tenant saas from your Laravel app with ease

13210.9k22](/packages/tenancy-framework)

PHPackages © 2026

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