Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

gabrielbuzzi's avatar

Multi Tenant Pattern

Hello guys,

I'm building a SaaS and i need to have multi tenant in this app, i'm using the orchestral/tenanti package to manage this, but i'm stuck because i don't know a good way to do this.

Following options:

  • Single Database and tables with prefix for each tenant(tenant1_products, tenant2_products)
  • Multi Database, each tenant has its own database.
  • Use Postgree Schemas, 1 Database with multiple schemas (i think maybe this should be the best option, but i don't know yet if the orchestral/tenanti package support this.)
0 likes
5 replies
luceos's avatar

I'm the maintainer of hyn/multi-tenant and the upcoming version 3 has support for postgresql and mariadb, is compatible with Laravel 5.3 and up and can work with database division using prefixes or separate databases. I'd love to consider using a different schema now that you mention it.

Hyn also integrates into your webserver ;)

1 like
xyrintech's avatar

@luceos What would you recommend something if we need to develop something similar to Quickbooks Online wherein the user interface will be in Angular 2? I mean to say what database schema.

gabrielbuzzi's avatar

@xyrintech you're building a SaaS? if you're my current pattern is a main database that is control all tenancies data, like (name, domain, limits, payments, etc..)

and for each tenancy i have a database with name based in the domain, and in this database i have the app databases (users, books)

something like this

JulioGa1011's avatar

@luceos Do you have any tutorial where you implement this? I never use multi tenant befere so I not familiar with the process.

Please or to participate in this conversation.