This is a simple example of using the https://github.com/RamyHakam/multi_tenancy_bundle
That bundle is a simple way to add multi-tenancy to your Symfony application.
You can check the bundle's README.md for the features list and configurations.
- Clone The repo
- Set
DATABASE_URL
in your .env file - Composer install
composer install
- Create the main DB using
symfony console d:d:create
- Migrate the current migration files to your main db using
symfony console d:m:m
- Create a new tenant by calling
create-tenant
route,This will create add a new tenant db to tenantdbConfig entity - Exceute
symfony console t:d:c
to create and migrate the new database added in the previous step - Call
update-tenant-store
route to add a new store category to your new tenant Db