How to do multi tenant application with Laravel

How to do multi tenant application with Laravel

2019-08-02T03:20:39.000Z

If you wants to run multiple websites using the same Laravel installation while keeping tenant specific data separated for fully independent multi-domain setups then it is pretty easily possible with this multi-tenant laravel package.

Here is the github link for the package: https://github.com/tenancy/multi-tenant

With this package, you can serve multiple websites each with one or more hostnames from the same codebase. It has clear separation of database, assets & also provides ability to override logic per tenant.

This is suitable for marketing companies or startups which are building Software as a Service(SaaS).

I know this architecture is opposite to famous micro-service architecture, but just posting it in case someone is in the need to do so.

This package offers following features under the hood:

  • Integration with the awesome Laravel framework.
  • Event driven, extensible architecture.
  • Close - optional - integration into the web server.
  • The ability to add tenant specific configs, code, routes etc.

Database separation methods:

  • One system database and separated tenant databases (default).
  • Table prefixed in the system database.
  • Or .. manually, the way you want, by listening to an event.