We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Multi tenant

Does anyone have experience with multi tenant apps usiong phalcon?

Hi Flavio a few years ago we developed a multi-tenant app and the best solution we found was independent databases for each customer and an extra one for the all customer data of the platform

Do you have an example on how you connect to the others databases?

My doubt is in the code. How do I write it to connect to a different databse based on tenant_id?

Maybe like in this tutorial? https://docs.phalcon.io/en/3.3/db-models#multiple-databases

Im sorry I can't. Its was a commercial project for an scientific institute of Argentine. It wasn't made in Phalcon but we use PHP and MySQL.

Now with Phalcon you must to create a master DB with customers and information about where the data is located. Then you set this data to create a second connection to "customer db" and the app works with this connection too

All the bussiness logic work with second db connection

I hope this information is useful