PHP Classes

Symfony Multi Tenant: Example of multi-tenant application using Symfony

Recommend this page to a friend!

  Author Author  
Picture of Nyi Nyi Lwin
Name: Nyi Nyi Lwin <contact>
Classes: 11 packages by
Country: Myanmar Myanmar
Innovation award
Innovation award
Nominee: 6x

Winner: 3x


  Detailed description   Download Download .zip .tar.gz   Install with Composer Install with Composer  
This package provides an example of multi-tenant application using Symfony.

It provides a command class to use the Symfony console that can create new tenants of an application by creating a new configuration to set a new database or a new sub-domain to run the same application for a new tenant.

The application uses a separate directory for the central application code and a different directory for the tenant code.

Details

Symfony Multi-tenant Example

This is a simple example of a multi-tenant application using Symfony 6.2

Installation

  1. Clone the repository
  2. Run `composer install`
  3. Update hostname in `.env`
  4. Run `bin/console doctrine:database:create`
  5. Run `bin/console doctrine:migrations:migrate`

Create a new tenant

  1. Run `bin/console app:tenant-create` to create a new tenant
  2. Run `bin/console app:tenant-migrate {tenantId}` to run migrations for a tenant
  3. Run `bin/console app:tenant-create-user {tenantId}` to create a new user for a tenant
  4. Run `bin/console app:tenant-maintenance {tenantId} {mode}` to enable or disable maintenance mode for a tenant

Todo

  • [ ] Add tenant events
  • [ ] Add tests

  Classes of Nyi Nyi Lwin  >  Symfony Multi Tenant  >  Download Download .zip .tar.gz  >  Support forum Support forum  >  Blog Blog (1)  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: Symfony Multi Tenant
Base name: symfony-multi-tenant
Description: Example of multi-tenant application using Symfony
Version: 1.0.1
PHP version: 5
License: The PHP License
 
  Groups   Applications   Files Files  

  Groups  
Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes
Group folder image Libraries Frameworks and libraries of cooperating classes View top rated classes


  Innovation Award  
PHP Programming Innovation award winner
February 2023
Winner
Multi-tenant applications serve multiple users or customers running the same code base and various versions of the same application as if the applications are separate.

This type of application structure allows a single effort to address the needs of different customers with minimal measure of adaptation.

This package provides an example of a multi-tenant application using the Symfony framework to help other developers learn from this effort.

Manuel Lemos

  Applications that use this package  
No pages of applications that use this class were specified.

Add link image If you know an application of this package, send a message to the author to add a link here.

  Files folder image Files  
File Role Description
Files folder image.github (1 file)
Files folder imagebin (1 file)
Files folder imageconfig (4 files, 2 directories)
Files folder imagemigrations (2 directories)
Files folder imagepublic (1 file)
Files folder imagesrc (1 file, 2 directories)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file docker-compose.override.yml Data Auxiliary data
Accessible without login Plain text file docker-compose.yml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file symfony.lock Data Auxiliary data

  Files folder image Files  /  .github  
File Role Description
  Accessible without login Plain text file FUNDING.yml Data Auxiliary data

  Files folder image Files  /  bin  
File Role Description
  Accessible without login Plain text file console Example Example script

  Files folder image Files  /  config  
File Role Description
Files folder imagepackages (9 files)
Files folder imageroutes (1 file)
  Plain text file bundles.php Class Class source
  Accessible without login Plain text file preload.php Aux. Auxiliary script
  Accessible without login Plain text file routes.yaml Data Auxiliary data
  Accessible without login Plain text file services.yaml Data Auxiliary data

  Files folder image Files  /  config  /  packages  
File Role Description
  Accessible without login Plain text file cache.yaml Data Auxiliary data
  Accessible without login Plain text file doctrine.yaml Data Auxiliary data
  Accessible without login Plain text file doctrine_migrations.yaml Data Auxiliary data
  Accessible without login Plain text file framework.yaml Data Auxiliary data
  Accessible without login Plain text file lexik_jwt_authentication.yaml Data Auxiliary data
  Accessible without login Plain text file monolog.yaml Data Auxiliary data
  Accessible without login Plain text file routing.yaml Data Auxiliary data
  Accessible without login Plain text file security.yaml Data Auxiliary data
  Accessible without login Plain text file translation.yaml Data Auxiliary data

  Files folder image Files  /  config  /  routes  
File Role Description
  Accessible without login Plain text file framework.yaml Data Auxiliary data

  Files folder image Files  /  migrations  
File Role Description
Files folder imageCentral (2 files)
Files folder imageTenant (2 files)

  Files folder image Files  /  migrations  /  Central  
File Role Description
  Plain text file Version20230110051740.php Class Class source
  Plain text file Version20230213094906.php Class Class source

  Files folder image Files  /  migrations  /  Tenant  
File Role Description
  Plain text file Version20230111165939.php Class Class source
  Plain text file Version20230213094906.php Class Class source

  Files folder image Files  /  public  
File Role Description
  Accessible without login Plain text file index.php Example Example script

  Files folder image Files  /  src  
File Role Description
Files folder imageCentral (8 directories)
Files folder imageTenant (3 directories)
  Plain text file Kernel.php Class Class source

  Files folder image Files  /  src  /  Central  
File Role Description
Files folder imageCommand (4 files)
Files folder imageController (1 file)
Files folder imageDoctrine (1 directory)
Files folder imageEntity (2 files)
Files folder imageEventSubscriber (1 file)
Files folder imageException (1 file)
Files folder imageRepository (2 files)
Files folder imageServices (1 file)

  Files folder image Files  /  src  /  Central  /  Command  
File Role Description
  Plain text file TenantCreateCommand.php Class Class source
  Plain text file TenantCreateUserCommand.php Class Class source
  Plain text file TenantMaintenanceCommand.php Class Class source
  Plain text file TenantMigrationCommand.php Class Class source

  Files folder image Files  /  src  /  Central  /  Controller  
File Role Description
  Plain text file WelcomeController.php Class Class source

  Files folder image Files  /  src  /  Central  /  Doctrine  
File Role Description
Files folder imageDBAL (1 file)

  Files folder image Files  /  src  /  Central  /  Doctrine  /  DBAL  
File Role Description
  Plain text file TenantConnection.php Class Class source

  Files folder image Files  /  src  /  Central  /  Entity  
File Role Description
  Plain text file Tenant.php Class Class source
  Plain text file User.php Class Class source

  Files folder image Files  /  src  /  Central  /  EventSubscriber  
File Role Description
  Plain text file TenantSubscriber.php Class Class source

  Files folder image Files  /  src  /  Central  /  Exception  
File Role Description
  Plain text file MaintenanceModeException.php Class Class source

  Files folder image Files  /  src  /  Central  /  Repository  
File Role Description
  Plain text file TenantRepository.php Class Class source
  Plain text file UserRepository.php Class Class source

  Files folder image Files  /  src  /  Central  /  Services  
File Role Description
  Plain text file TenantService.php Class Class source

  Files folder image Files  /  src  /  Tenant  
File Role Description
Files folder imageController (1 file)
Files folder imageEntity (2 files)
Files folder imageRepository (2 files)

  Files folder image Files  /  src  /  Tenant  /  Controller  
File Role Description
  Plain text file PostController.php Class Class source

  Files folder image Files  /  src  /  Tenant  /  Entity  
File Role Description
  Plain text file Post.php Class Class source
  Plain text file User.php Class Class source

  Files folder image Files  /  src  /  Tenant  /  Repository  
File Role Description
  Plain text file PostRepository.php Class Class source
  Plain text file UserRepository.php Class Class source

Install with Composer Install with Composer - Download Download all files: symfony-multi-tenant.tar.gz symfony-multi-tenant.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.
  Files folder image Files  
File Role Description
Files folder image.github (1 file)
Files folder imagebin (1 file)
Files folder imageconfig (4 files, 2 directories)
Files folder imagemigrations (2 directories)
Files folder imagepublic (1 file)
Files folder imagesrc (1 file, 2 directories)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file docker-compose.override.yml Data Auxiliary data
Accessible without login Plain text file docker-compose.yml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file symfony.lock Data Auxiliary data

  Files folder image Files  /  .github  
File Role Description
  Accessible without login Plain text file FUNDING.yml Data Auxiliary data

  Files folder image Files  /  bin  
File Role Description
  Accessible without login Plain text file console Example Example script

  Files folder image Files  /  config  
File Role Description
Files folder imagepackages (9 files)
Files folder imageroutes (1 file)
  Plain text file bundles.php Class Class source
  Accessible without login Plain text file preload.php Aux. Auxiliary script
  Accessible without login Plain text file routes.yaml Data Auxiliary data
  Accessible without login Plain text file services.yaml Data Auxiliary data

  Files folder image Files  /  config  /  packages  
File Role Description
  Accessible without login Plain text file cache.yaml Data Auxiliary data
  Accessible without login Plain text file doctrine.yaml Data Auxiliary data
  Accessible without login Plain text file doctrine_migrations.yaml Data Auxiliary data
  Accessible without login Plain text file framework.yaml Data Auxiliary data
  Accessible without login Plain text file lexik_jwt_authentication.yaml Data Auxiliary data
  Accessible without login Plain text file monolog.yaml Data Auxiliary data
  Accessible without login Plain text file routing.yaml Data Auxiliary data
  Accessible without login Plain text file security.yaml Data Auxiliary data
  Accessible without login Plain text file translation.yaml Data Auxiliary data

  Files folder image Files  /  config  /  routes  
File Role Description
  Accessible without login Plain text file framework.yaml Data Auxiliary data

  Files folder image Files  /  migrations  
File Role Description
Files folder imageCentral (2 files)
Files folder imageTenant (2 files)

  Files folder image Files  /  migrations  /  Central  
File Role Description
  Plain text file Version20230110051740.php Class Class source
  Plain text file Version20230213094906.php Class Class source

  Files folder image Files  /  migrations  /  Tenant  
File Role Description
  Plain text file Version20230111165939.php Class Class source
  Plain text file Version20230213094906.php Class Class source

  Files folder image Files  /  public  
File Role Description
  Accessible without login Plain text file index.php Example Example script

  Files folder image Files  /  src  
File Role Description
Files folder imageCentral (8 directories)
Files folder imageTenant (3 directories)
  Plain text file Kernel.php Class Class source

  Files folder image Files  /  src  /  Central  
File Role Description
Files folder imageCommand (4 files)
Files folder imageController (1 file)
Files folder imageDoctrine (1 directory)
Files folder imageEntity (2 files)
Files folder imageEventSubscriber (1 file)
Files folder imageException (1 file)
Files folder imageRepository (2 files)
Files folder imageServices (1 file)

  Files folder image Files  /  src  /  Central  /  Command  
File Role Description
  Plain text file TenantCreateCommand.php Class Class source
  Plain text file TenantCreateUserCommand.php Class Class source
  Plain text file TenantMaintenanceCommand.php Class Class source
  Plain text file TenantMigrationCommand.php Class Class source

  Files folder image Files  /  src  /  Central  /  Controller  
File Role Description
  Plain text file WelcomeController.php Class Class source

  Files folder image Files  /  src  /  Central  /  Doctrine  
File Role Description
Files folder imageDBAL (1 file)

  Files folder image Files  /  src  /  Central  /  Doctrine  /  DBAL  
File Role Description
  Plain text file TenantConnection.php Class Class source

  Files folder image Files  /  src  /  Central  /  Entity  
File Role Description
  Plain text file Tenant.php Class Class source
  Plain text file User.php Class Class source

  Files folder image Files  /  src  /  Central  /  EventSubscriber  
File Role Description
  Plain text file TenantSubscriber.php Class Class source

  Files folder image Files  /  src  /  Central  /  Exception  
File Role Description
  Plain text file MaintenanceModeException.php Class Class source

  Files folder image Files  /  src  /  Central  /  Repository  
File Role Description
  Plain text file TenantRepository.php Class Class source
  Plain text file UserRepository.php Class Class source

  Files folder image Files  /  src  /  Central  /  Services  
File Role Description
  Plain text file TenantService.php Class Class source

  Files folder image Files  /  src  /  Tenant  
File Role Description
Files folder imageController (1 file)
Files folder imageEntity (2 files)
Files folder imageRepository (2 files)

  Files folder image Files  /  src  /  Tenant  /  Controller  
File Role Description
  Plain text file PostController.php Class Class source

  Files folder image Files  /  src  /  Tenant  /  Entity  
File Role Description
  Plain text file Post.php Class Class source
  Plain text file User.php Class Class source

  Files folder image Files  /  src  /  Tenant  /  Repository  
File Role Description
  Plain text file PostRepository.php Class Class source
  Plain text file UserRepository.php Class Class source

Install with Composer Install with Composer - Download Download all files: symfony-multi-tenant.tar.gz symfony-multi-tenant.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.