hakam/multi-tenancy-bundle

Symfony bundle to extend doctrine to support db switcher and multi tenants

Installs: 22 371

Dependents: 0

Suggesters: 0

Security: 0

Stars: 95

Watchers: 7

Forks: 31

Open Issues: 5

Type:symfony-bundle

v2.8.3 2025-06-18 18:47 UTC

README

Multi-Tenancy Bundle (Desktop Wallpaper)

Action Status Total Downloads Symfony Flex

๐Ÿ“š Full Documentation: https://ramyhakam.github.io/multi_tenancy_bundle/

๐Ÿงฉ 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 TenantEntityManager service 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

๐Ÿ“„ License

MIT ยฉ Ramy Hakam