Member-only story
3 min readApr 22, 2023
Simplify Multi-Tenancy in Symfony with the Multi-Tenancy Bundle
https://github.com/RamyHakam/multi_tenancy_bundle
Features
The Multi-Tenancy Bundle comes packed with a range of features designed to make multi-tenant development in Symfony a breeze. These include:
- Ability to switch between tenant databases by triggering an event
- Distinct entity mapping for both the main and tenant entities
- Custom extended Doctrine commands for managing tenant databases independently
- Capability to generate and execute migrations for each database separately
- Ability to execute bulk migrations for all tenant databases with a single command (coming soon)
- Ability to create and prepare a tenant database if it doesn’t already exist
Installation
To install the Multi-Tenancy Bundle, you need Symfony v5+ and the following dependencies:
- Doctrine Bundle
- Doctrine Migration Bundle v3+
Here are the steps to install the bundle using Composer:
- Step 1: Run the following command in your terminal:
$ composer require hakam/multi-tenancy-bundle
- Step 2: Configure your tenant database(s) in…