PHPackages                             zhortein/multi-tenant-bundle - 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. zhortein/multi-tenant-bundle

ActiveSymfony-bundle[Framework](/categories/framework)

zhortein/multi-tenant-bundle
============================

A comprehensive Symfony 7+ bundle for building multi-tenant applications with PostgreSQL 16 support, featuring multiple resolution strategies, tenant-aware services, and automatic database filtering.

4301[1 issues](https://github.com/Zhortein/multi-tenant-bundle/issues)PHPCI passing

Since Aug 21Pushed 8mo agoCompare

[ Source](https://github.com/Zhortein/multi-tenant-bundle)[ Packagist](https://packagist.org/packages/zhortein/multi-tenant-bundle)[ RSS](/packages/zhortein-multi-tenant-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Zhortein Multi-Tenant Bundle
============================

[](#zhortein-multi-tenant-bundle)

A comprehensive Symfony 7+ bundle for building multi-tenant applications with PostgreSQL 16 support.

[![PHP Version](https://camo.githubusercontent.com/5c8ce4571ddf4b6b8ca847e0c4c079de98fc6460eb7eae9c81ca63319c21f546/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e332d626c75652e737667)](https://php.net/)[![Symfony Version](https://camo.githubusercontent.com/130d165a20ffefc453aa640154c04ea5c7b393caf4b2ed3e58fdd3ea7761e468/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73796d666f6e792d253345253344372e302d677265656e2e737667)](https://symfony.com/)[![PostgreSQL Version](https://camo.githubusercontent.com/180ddd9a66d6434452b0e7b9bc0dde19fd055e045ff079c36511767ae4e9d480/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f706f737467726573716c2d31362d626c75652e737667)](https://www.postgresql.org/)

Features
--------

[](#features)

- 🏢 **Multiple Tenant Resolution Strategies**: Subdomain, path-based, header-based, domain-based, DNS TXT, hybrid, or custom resolvers
- 🗄️ **Database Strategies**: Shared database with filtering or separate databases per tenant
- ⚡ **Performance Optimized**: Built-in caching for tenant settings and configurations
- 🔧 **Doctrine Integration**: Automatic tenant filtering with Doctrine ORM
- 📧 **Tenant-Aware Services**: Mailer with automatic tenant propagation, Messenger with context preservation, and file storage integration
- 🎯 **Event-Driven**: Database switching events and automatic tenant context resolution
- 🛠️ **Advanced Commands**: Schema management, migrations, and fixtures for tenants
- 🧪 **Comprehensive Test Kit**: First-class testing utilities to prove tenant isolation works
- 🔒 **RLS Integration**: PostgreSQL Row-Level Security for defense-in-depth
- 📊 **PHPStan Level Max**: Static analysis at maximum level

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

[](#installation)

Install the bundle via Composer:

```
composer require zhortein/multi-tenant-bundle
```

Enable the bundle in your `config/bundles.php`:

```
