PHPackages                             mk-devs/multi-tenant - 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. [Database &amp; ORM](/categories/database)
4. /
5. mk-devs/multi-tenant

ActiveLibrary[Database &amp; ORM](/categories/database)

mk-devs/multi-tenant
====================

Create, migrate and seed different databases dynamiclly without having to change your app connection.

1.1(6y ago)08MITPHP

Since Oct 29Pushed 6y ago1 watchersCompare

[ Source](https://github.com/mk-devs/multi-tenant)[ Packagist](https://packagist.org/packages/mk-devs/multi-tenant)[ RSS](/packages/mk-devs-multi-tenant/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Laravel Multi-Tenant
====================

[](#laravel-multi-tenant)

Multi-Tenant is a Laravel package that can be used to create, migrate and seed different databases dynamiclly without having to change your app connection.

This is useful for web applications that stores data of each tenant in different database.

Installing
----------

[](#installing)

You can install the package via composer:

```
composer require mk-devs/multi-tenant

```

The package will register itself automatically.

Usage
-----

[](#usage)

Installing the packege on your Laravel project will add MultiTenant class as well as helpful artisan commands.

#### Artisan Commands

[](#artisan-commands)

1. `php artisan tenant:create database connection`
2. `php artisan tenant:migrate database connection --path`
3. `php artisan tenant:refresh database connection`
4. `php artisan tenant:rollback database connection`
5. `php artisan tenant:seed database connection --class`

#### Available Methods

[](#available-methods)

1. `create` Create a new database `params: [database, connection]`
2. `migrate` Run migrate for specific database `params: [database, connection, path]`
3. `refresh` Reset and re-run all migrations `params: [database, connection]`
4. `rollback` Rollback the last database migration `params: [database, connection]`
5. `seed` Run seed for specific database `params: [database, connection, class]`
6. `set` Change app database connection in run time `params: [database, connection]`

#### Params

[](#params)

ParamRequiredDefaultdatabasetruenullconnectionfalseCurrent connectionclassfalsenullpathfalsenull#### Use Cases

[](#use-cases)

```
// Simple examples
MultiTenant::migrate('database_name');

MultiTenant::create('database_name')->migrate();

MultiTenant::seed([
    'database' => 'database_name',
    'connection' => 'mysql',
    'class' => 'CustomersTableSeed'
]);

MultiTenant::set([
    'database' => 'database_name',
    'connection' => 'mysql',
]);

// Advanced example
MultiTenant::migrate([
    'database' => 'database_name',
    'connection' => 'mysql',
    'path' => '/database/migrations/tenant'
])->seed(['class' => 'CustomersTableSeed'])->set();
```

License
-------

[](#license)

Multi-Tenant is open-sourced software licensed under the [MIT](https://choosealicense.com/licenses/mit/)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

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

Total

2

Last Release

2389d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a61f5be60d97b45ab1fea383ed6cf2c6ef10cdf9a0ca2bd3a5cb6fedc443b96?d=identicon)[mk-devs](/maintainers/mk-devs)

---

Top Contributors

[![mk-kamel](https://avatars.githubusercontent.com/u/57094500?v=4)](https://github.com/mk-kamel "mk-kamel (7 commits)")

---

Tags

laravelmigrationsmulti-tenantmulti-database

### Embed Badge

![Health badge](/badges/mk-devs-multi-tenant/health.svg)

```
[![Health](https://phpackages.com/badges/mk-devs-multi-tenant/health.svg)](https://phpackages.com/packages/mk-devs-multi-tenant)
```

###  Alternatives

[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

240173.5k2](/packages/dragon-code-laravel-deploy-operations)[nunomaduro/laravel-optimize-database

Publishes migrations that make your database production ready.

26123.0k](/packages/nunomaduro-laravel-optimize-database)[orptech/laravel-migration-partition

Laravel extensions that extends Illuminate to enable partitioned table creation within Laravel migrations.

3426.7k](/packages/orptech-laravel-migration-partition)

PHPackages © 2026

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