Download the PHP package apajo/symfony-multi-tenancy-bundle without Composer
On this page you can find all versions of the php package apajo/symfony-multi-tenancy-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download apajo/symfony-multi-tenancy-bundle
More information about apajo/symfony-multi-tenancy-bundle
Files in apajo/symfony-multi-tenancy-bundle
Package symfony-multi-tenancy-bundle
Short Description Symfony multi tenancy bundle
License MIT
Homepage https://www.apajo.ee
Informations about the package symfony-multi-tenancy-bundle
Symfony Multi Tenancy Bundle
Description
There are many packages that provide multi tenancy in Symfony. All of them provide only different database configuration per tenant.
This package's goal is to provide a way to manage any kind of configuration in your system.
This bundle aims to provide multi tenancy on a higher level. It provides a way to dynamically change the system configuration based on the tenant (database, media provider, mailer etc).
It also bundles a way to manage migrations for each tenant.
The package's development is in early stages, any feedback is welcome.
Requirements
- Symfony 6.4 / 7.1
- Doctrine Bundle 2.12
- Doctrine Migrations Bundle 3.3
- Symfony Security Bundley
- PHP 8.2
Installation
Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.
Applications that use Symfony Flex
Open a command console, enter your project directory and execute:
Applications that don't use Symfony Flex
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the config/bundles.php
file of your project:
Configuration
To change your
doctrine.yml
You need 2 connections and entity_managers:
In this case thay are named default
and tenant
but you can name them as you wish.
NB! Third party packages may require the
default
connection to be present so you might want to keep thedefault
name.
Connection and entity manager default
are common for all the individual tenants.
Connection and entity manager tenant
are specific for the tenant.
apajo_multi_tenancy.yml
services.yml
Every adapter you use must be registered as a service. Example of the built-in ones:
Doctrine migrations configuration
Recommended path for the configuration files is config/migrations/
.
default.yml
tenant.yml
Adapters
Adapters are responsible for dynamic configuration changes based on tenant table values at runtime.
For more on (built-in) adapters see Adapters directory
Resolvers
Resolvers are responsible for resolving current tenant.
For more on (built-in) resolvers see Resolvers directory
Database migrations
This bundle adds just 2 new commands to your project:
NB! All other migration commands are as-is by DoctrineMigrationsBundle
Examples
Switch/select tenant
Iterate over all tenant environments
Development
Testing
Issues
Feel free to report an issue under GitHub Issues
Known Issues
- Resetting to default/initial tenant does not work
- Symfony profiler currently shows only default entity managers migrations
Contributing
Feel free to contribute
Versioning
Versions must be numbered following the Semantic Versioning Specification.
Packagist
Packagist link
Thanks to
This bundle is inspired by the RamyHakam / multi_tenancy_bundle
All versions of symfony-multi-tenancy-bundle with dependencies
doctrine/annotations Version ^2.0
doctrine/doctrine-bundle Version ^2.12
doctrine/doctrine-migrations-bundle Version ^3.3
knplabs/gaufrette Version ^0.11.1
symfony/config Version ^6.4|^7.1
symfony/dependency-injection Version ^6.4|^7.1
symfony/filesystem Version ^6.4|^7.1
symfony/mailer Version ^6.4|^7.1
symfony/orm-pack Version ^2.4
symfony/process Version ^6.4|^7.1
symfony/runtime Version ^6.4|^7.1
symfony/security-bundle Version ^6.4|^7.1