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

djoo's avatar
Level 1

Multi Laravel Instances with One common database

Hey guys,

We have already built a nice Laravel instance and plan to create 2 new instances. The goal is to build a kind of environment with one feature by instance (and by url)

Exemple : Instance 1 (we already have) : https://instance1.com (let users build a website) Instance 2 : https://instance2.com (let users handle orders and payments) Instance 3 : https://instance3.com (let users access to a backend if he payed)

We want to make it great for the users : If one user is logged to an instance, he is automatically logged on the others.

From now, we think to do like this :

  • One common database for all the instances
  • The table users is "shared"
  • Other tables are specific for each instance (maybe with a prefix in the table, like : instance1_table, instance2_table)

Questions :

  • Is it the good way to do this in Laravel ?
  • How can we manage to let the user session shared between instance ( same APP_KEY, and it's gonna work directly ) ?
  • How to be sure to don't put the mess at every migrations ?

Thanks a lot

Jo

0 likes
3 replies
djoo's avatar
Level 1

Thanks for sharing. I i understand well it's in case you just have one Laravel Instance : "Run multiple websites using the same Laravel installation". In my case i have several instances.

Please or to participate in this conversation.