PHPackages                             kwalit/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. [Framework](/categories/framework)
4. /
5. kwalit/multi-tenant

ActiveLibrary[Framework](/categories/framework)

kwalit/multi-tenant
===================

A simple and lightweight package to craft multi-tenant applications with Laravel.

v1.0(10y ago)2321MITPHPPHP &gt;=5.5.9

Since May 13Pushed 10y ago1 watchersCompare

[ Source](https://github.com/kwalit/multi-tenant)[ Packagist](https://packagist.org/packages/kwalit/multi-tenant)[ RSS](/packages/kwalit-multi-tenant/feed)WikiDiscussions master Synced 4w ago

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

multi-tenant
============

[](#multi-tenant)

A simple and lightweight package to craft multi-tenant applications with Laravel.

#### Installation

[](#installation)

This package relies on composer as dependency manger. Run the `composer require kwalit/multi-tenant` to install this package. Next add the service provider within `config/app.php`: `Kwalit\MultiTenant\MultiTenantServiceProvider::class` in order to be bootstrapped.

#### Defining tenants

[](#defining-tenants)

Tenants are defined in `config/tenant.php`. Make sure to run the `php artisan vendor:publish` command to have this file created. By default, the tenant directories are located at `storage/tenants/{tenantID}`. If you want to use a different base path, override the `path` array key.

```
return [
    'path' => storage_path('tenants'),

    'hosts' => [
        'mysite.com' => [
            'id'    => 'mysite',
            'name'  => 'MySite',
            'https' => true,
        ],
        'anothersite.com' => [
            'id'    => 'anothersite',
            'name'  => 'AnotherSite',
            'https' => false,
            'foo' => 'bar',
        ]
    ]
]

```

In some cases you might want to add custom tenant-specific parameters, like an API key, for instance. Simply use the helper function to retrieve a tenant-specific key value: `tenant('foo')`.

#### Eloquent models

[](#eloquent-models)

In order for your models to deal with multiple connections, simply extend the `TenantModel` class or implement the `HasTenancy` trait. Both classes do exactly the same. Choose the approach you prefer.

#### Migrating and seeding

[](#migrating-and-seeding)

Each tenant has it's own database, which you will want to migrate and seed every once in a while. Define your tenant connections within `config/database.php` and simply add the `--database` parameter to tell artisan which database to choose, for example:

```
php artisan migrate:refresh  --database {tenantConnection} --seed

```

#### Managing assets

[](#managing-assets)

Each tenant has it's own assets which are, by default, stored at `storage/tenants/{tenantID}/assets`. Use the helper function `tasset('foo.svg')` to retrieve a tenant asset. This function will use the route `asset/{path}` to retrieve assets outside the public directory.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3700d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/46860?v=4)[Jason Kohles](/maintainers/JasonK)[@jasonk](https://github.com/jasonk)

---

Top Contributors

[![Jasonkoolman](https://avatars.githubusercontent.com/u/422729?v=4)](https://github.com/Jasonkoolman "Jasonkoolman (2 commits)")

### Embed Badge

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

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

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k104.3M836](/packages/laravel-socialite)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k38.6M289](/packages/laravel-dusk)[nineinchnick/edatatables

Grid widget for the Yii Framework, wrapper for the DataTables jQuery plugin

173.2k](/packages/nineinchnick-edatatables)[link-cloud/fast-hyperf

LinkCloud Fast Hyperf

241.2k1](/packages/link-cloud-fast-hyperf)

PHPackages © 2026

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