boruta / multi-tenancy-bundle
Flexible and production-ready multi-tenancy bundle for Symfony. Fork on: RamyHakam/multi_tenancy_bundle
Package info
github.com/borutainfo/multi_tenancy_bundle
Type:symfony-bundle
pkg:composer/boruta/multi-tenancy-bundle
Requires
- php: ^8.1|^8.2|^8.3|^8.4
- doctrine/annotations: ^2.0
- doctrine/doctrine-bundle: ^2.7
- doctrine/doctrine-migrations-bundle: ^3.0
- symfony/config: ^v6.4.0|^7.0
- symfony/dependency-injection: ^v6.4.0|^7.0
- symfony/filesystem: ^6.4|^7.0
- symfony/http-kernel: ^v6.4.0|^7.0
- symfony/orm-pack: ^2.0
Requires (Dev)
- dg/bypass-finals: ^1.9
- doctrine/doctrine-fixtures-bundle: ^3.6
- phpunit/phpunit: ^9.5
- symfony/phpunit-bridge: ^v6.4.0|^7.0
This package is auto-updated.
Last update: 2026-05-29 02:04:30 UTC
README
๐ Full Documentation: Documentation
๐งฉ Overview
The Symfony Multi-Tenancy Bundle enables scalable, production-ready multi-tenancy for Symfony applications.
Ideal for SaaS platforms, region-based services, and multi-vendor e-commerce systems, this bundle is built around a database-per-tenant architecture, giving each tenant:
- A fully isolated database
- Independent schema and migrations
- Configurable connection parameters (host, driver, credentials)
It integrates seamlessly with Doctrine and Symfonyโs service container, offering:
- Automatic tenant database switching at runtime via
SwitchDbEvent - Separate migration and fixture paths for main vs. tenant databases
- Dedicated
TenantEntityManagerservice for runtime isolation
For full usage examples and advanced configuration, see the documentation.
๐ Quick Installation
1. Via Symfony Flex (Recommended)
composer require hakam/multi-tenancy-bundle
Symfony Flex will automatically scaffold config, register the bundle, and create:
src/Entity/Main/
src/Entity/Tenant/
migrations/Main/
migrations/Tenant/
2. Manual Installation
composer require hakam/multi-tenancy-bundle
Then register in config/bundles.php, copy the example hakam_multi_tenancy.yaml from docs, and create the required directories.
๐ Useful Links
- Full Documentation: [https://ramyhakam.github.io/multi_tenancy_bundle/]
- GitHub: https://github.com/RamyHakam/multi_tenancy_bundle
- Packagist: https://packagist.org/packages/hakam/multi-tenancy-bundle
- Example Project: https://github.com/RamyHakam/multi-tenancy-project-example
๐ License
MIT ยฉ Ramy Hakam