PHPackages                             muhammad-nawlo/multitenant-plugin - 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. muhammad-nawlo/multitenant-plugin

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

muhammad-nawlo/multitenant-plugin
=================================

A comprehensive multitenant plugin for Filament that integrates seamlessly with stancl/tenancy and filament-shield for role-based permissions

v1.0.15(9mo ago)1241[4 PRs](https://github.com/Muhammad-Nawlo/multitenant-plugin/pulls)MITPHPPHP ^8.0CI passing

Since Jul 8Pushed 1mo agoCompare

[ Source](https://github.com/Muhammad-Nawlo/multitenant-plugin)[ Packagist](https://packagist.org/packages/muhammad-nawlo/multitenant-plugin)[ Docs](https://github.com/muhammad-nawlo/multitenant-plugin)[ GitHub Sponsors](https://github.com/Muhammad-Nawlo)[ RSS](/packages/muhammad-nawlo-multitenant-plugin/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (15)Versions (21)Used By (0)

Filament Multitenant Plugin
===========================

[](#filament-multitenant-plugin)

A comprehensive multitenant plugin for Filament that integrates seamlessly with `stancl/tenancy` and `spatie/laravel-permission` to make multitenant applications easier to build and manage. This plugin provides complete tenant management with role-based permissions and beautiful Filament interfaces.

[![Latest Version on Packagist](https://camo.githubusercontent.com/0b1bf14f2ddb6cd21d79e55772e452bd66542f6d8d5a3784c2f37c077c77a545/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d7568616d6d61642d6e61776c6f2f6d756c746974656e616e742d706c7567696e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/muhammad-nawlo/multitenant-plugin)[![GitHub Tests Action Status](https://camo.githubusercontent.com/631afad2f54207ee7a6b5405c51041ccc992ac99f1abf40f6e10fe082e2db6bf/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d7568616d6d61642d6e61776c6f2f6d756c746974656e616e742d706c7567696e2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/muhammad-nawlo/multitenant-plugin/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/e5587f27825fd81e358e104223bf773e921eaae62b278b50010d3ae87aa72e19/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d7568616d6d61642d6e61776c6f2f6d756c746974656e616e742d706c7567696e2f6669782d7068702d636f64652d7374796c696e672e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/muhammad-nawlo/multitenant-plugin/actions?query=workflow%3A%22Fix+PHP+code+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/eff15c5fb75ef4fd254d07b36f03f393f05aef55ecadd6895e8fb7bc84f0de54/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d7568616d6d61642d6e61776c6f2f6d756c746974656e616e742d706c7567696e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/muhammad-nawlo/multitenant-plugin)

Features
--------

[](#features)

- 🏢 **Tenant Management**: Complete CRUD operations for tenants through Filament
- 📊 **Tenant Dashboard**: Beautiful dashboard with tenant statistics and quick actions
- 🔧 **Easy Integration**: Simple traits to make your resources tenant-aware
- 🔒 **Role-based Permissions**: Tenant-specific access control using Spatie Laravel Permission
- ⚙️ **Flexible Configuration**: Extensive configuration options
- 🚀 **Quick Setup**: Automated setup command for fast deployment
- 🎨 **Modern UI**: Beautiful Filament interface for tenant management
- 🔒 **Robust Error Handling**: Graceful degradation when tenancy isn't available
- 📝 **Comprehensive Documentation**: Detailed examples and usage guides
- 🛠️ **Production Ready**: Thoroughly tested with proper error handling and edge cases covered

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

[](#installation)

1. **Install the package via Composer:**

```
composer require muhammad-nawlo/multitenant-plugin
```

2. **Install required dependencies (if not already installed):**

```
# Install tenancy package
composer require stancl/tenancy

# Install spatie/laravel-permission for permissions
composer require spatie/laravel-permission
```

3. **Publish required configurations:**

```
# Publish multitenant plugin config
php artisan vendor:publish --tag="multitenant-plugin-config"

# Publish tenancy config (if not already published)
php artisan vendor:publish --provider="Stancl\Tenancy\TenancyServiceProvider" --tag="config"

# Publish spatie/laravel-permission config (if using permissions)
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" --tag="config"
```

4. **Run the setup command:**

```
php artisan multitenant:setup
```

5. **Add the plugin to your Filament panel:**

```
use MuhammadNawlo\MultitenantPlugin\MultitenantPluginManager;

// In your panel configuration
$panel->plugins([
    MultitenantPluginManager::make(),
]);
```

### Installation Notes

[](#installation-notes)

- The plugin depends on `stancl/tenancy` and `spatie/laravel-permission` but does not automatically publish their configs
- You need to manually publish the config files for these dependencies if you haven't already
- This gives you full control over the configuration of these packages

Quick Start
-----------

[](#quick-start)

### Making Resources Tenant-Aware

[](#making-resources-tenant-aware)

Use the `TenantAwareResource` trait in your Filament resources:

```
