tomatophp/filament-tenancy

Tenancy multi-database integration for FilamentPHP
4,569 62
Install
composer require tomatophp/filament-tenancy
Latest Version:5.0.0
PHP:^8.2
License:MIT
Last Updated:Sep 15, 2026
Links: GitHub  ·  Packagist
Maintainer: fadymondy

Screenshot

Filament Tenancy

Latest Stable Version License Downloads

Tenancy multi-database integration for FilamentPHP

[!WARNING]
We have a known problem with route:cache if you find a problem with multi-database connection from your tenant side you may face this problem just use php artisan route:clear and it will be fixed.

Screenshots

Tenants Tenants Dark Create Edit Password Password Dark

Features

  • Multi Database
  • Create Tenant Resource
  • Sync Tenant Resource
  • Password Change
  • Tenant Impersonate
  • Share Tenant Data
  • Custom Theme For Tenant
  • Livewire Component For Register New Tenant

Version Compatibility

Plugin Filament Laravel PHP
1.x (v3 branch) 3.x 10.x | 11.x 8.1+
5.x 5.x 12.x | 13.x 8.2+

Installation

composer require tomatophp/filament-tenancy

after install your package please run this command

php artisan filament-tenancy:install

in your .env add this

CENTRAL_DOMAIN=tomatophp.test

where tomatophp.test is your central domain, and make sure you add a root user or a user have a permission to create database, then in your main central panel add this plugin

use TomatoPHP\FilamentTenancy\FilamentTenancyPlugin;

->plugin(FilamentTenancyPlugin::make()->panel('app'))

now you need to create a panel for tenancy app

php artisan filament:panel

and make the name same as ->panel('app'), in your tenancy app panel add this plugin


use TomatoPHP\FilamentTenancy\FilamentTenancyAppPlugin;

->plugin(FilamentTenancyAppPlugin::make())

tenant databases are resolved by stancl/tenancy from config/tenancy.php (published by the install command), so you do not need an extra database connection. In multi-database mode the database user must be allowed to create databases.

[!NOTE] Upgrading from 1.x: the dynamic connection in config/database.php is no longer used, you can remove it.

new tenant databases are created and migrated with the migrations in database/migrations/tenant. To seed them, set a tenant seeder in config/tenancy.php (your application DatabaseSeeder is not run inside tenants)

'seeder_parameters' => [
    '--class' => \Database\Seeders\TenantSeeder::class,
    '--force' => true,
],

on your bootstrap\app.php add this middleware

use Stancl\Tenancy\Middleware\InitializeTenancyByDomain;
use Stancl\Tenancy\Middleware\InitializeTenancyBySubdomain;

->withMiddleware(function (Middleware $middleware) {
    $middleware->group('universal', [
        InitializeTenancyByDomain::class,
        InitializeTenancyBySubdomain::class,
    ]);
})

Allow Impersonate

you can allow impersonate to tanent panel with 1 click by use this method on your plugin


use TomatoPHP\FilamentTenancy\FilamentTenancyPlugin;

->plugin(
    FilamentTenancyPlugin::make()
        ->panel('app')
        ->allowImpersonate()
)

Publish Assets

you can publish config file by use this command

php artisan vendor:publish --tag="filament-tenancy-config"

you can publish views file by use this command

php artisan vendor:publish --tag="filament-tenancy-views"

you can publish languages file by use this command

php artisan vendor:publish --tag="filament-tenancy-lang"

you can publish migrations file by use this command

php artisan vendor:publish --tag="filament-tenancy-migrations"

Other Filament Packages

Checkout our Awesome TomatoPHP

Related Packages

tomatophp/filament-cms

Full CMS System with support of importing integrations and multi meta functions

13,079 123
stancl/tenancy

Automatic multi-tenancy for your Laravel application.

10,077,434 4,410
hotash/octane-tenancy

Automatic multi-tenancy for your Laravel application.

19 0
leek/filament-subtenant-scope

Second-level tenancy scope (e.g. service area, region, location) for Filament pa...

2,147 29
tomatophp/filament-api

Generate APIs from your filament resource using single line of code

7,492 54