I am considering creating a multi-tenant SaaS application, and that i found several sites that describe a good method to separate the information using tenantIDs and updateable sights. e.g. This blog post

Everything relies upon a chance to have your user accounts authenticated from the master customers table after which getting their particular database connections use individuals user-specific qualifications. By doing this, the sights can pull the userid and map it towards the tenantID to show that user's view. However, most PHP frameworks are usually very static if this involves database connections (saved in text config files). They seem to be at odds.

Does anybody know: a) steps to make CodeIgniter handle this beautifully? b) another PHP framework that may?

In a horrifyingly fundamental level this can be done:


Expand it as being needed, or slowly move the logic into MY_Controller for additional versatility.

There's a subject speaking relating to this around the Code Igniter forums.


It appears as if you setup your customers DB as the primary database within the config file, then you definitely produce a config array for any new connection for any user based on information for the reason that customers DB. So, I suppose you'd have to a minimum of keep DB title within the customers database.

Unsure how good this works though, when i haven't had an event to give it a try yet.

Sorry if that is less than that which you were searching for, however it should provide you with a concept of a Code Igniter approach.