How to do multi tenant application with Laravel

How to do multi tenant application with Laravel

Nov 02, 2019 / Moody Developer

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.



Similar Articles

Moving existing PHPUnit tests to PEST in Laravel application

Moving existing PHPUnit tests to PEST in Laravel application

How to move existing PHPUnit tests to PEST within your Laravel application.
Read more...
What is new to Laravel 6?

What is new to Laravel 6?

Today Laravel 6 has finally officially released. Let's have a detailed look at what is changing in Laravel 6.
Read more...
Connect your laravel application to Sqlite DB

Connect your laravel application to Sqlite DB

Quickly connecting with sqlite database within laravel application
Read more...