PHP Classes

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

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 54 All time: 10,631 This week: 56Up
Version License PHP version Categories
symfony-multi-tenant 1.0.1The PHP License5PHP 5, Libraries
Description 

Author

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.

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
Picture of Nyi Nyi Lwin
  Performance   Level  
Innovation award
Innovation award
Nominee: 7x

Winner: 4x

 

Documentation

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

  Files folder image Files (45)  
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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:54
This week:0
All time:10,631
This week:56Up