Laravel Tenancy – Multi-Tenant Package for Laravel
Published on by Paul Redmond
Laravel Tenancy is a package by Daniël Klabbers, Paulo Trajano, and Bertrand Kintanar, for making your Laravel application multi-tenant:
The unobtrusive Laravel package that makes your app multi-tenant. Serving multiple websites, each with one or more hostnames from the same codebase. But with clear separation of assets, database and the ability to override logic per tenant.
Suitable for marketing companies that like to re-use functionality for different clients or start-ups building the next software as a service.
The Laravel Tenancy package includes the following features:
- Integration with the Laravel framework
- Event-driven extensible architecture
- Close – optional – integration into the web server
- The ability to add tenant-specific configs, code, routes, etc.
A couple of standard approaches to database architecture in multi-tenant applications include:
- One database for system data and tenants’ tables are prefixed
- One database for system data and separate tenant databases
Laravel Tenancy supports both methods, and you can manually customize it the way you want through event listeners.
The tenancy/tenancy package is the successor to hyn/multi-tenant, which means if you want to use this in production you’d probably use the hyn/multi-tenant
package as tenancy/tenancy
is still a work in progress.
The documentation for hyn/multi-tenant is an excellent place to start learning about Tenancy for requirements, installation, and implementation details.