spatie / laravel-multitenancy
Make your Laravel app usable by multiple tenants
Fund package maintenance!
spatie
spatie.be/open-source/support-us
Installs: 1 533 582
Dependents: 9
Suggesters: 0
Security: 0
Stars: 1 107
Watchers: 27
Forks: 153
Open Issues: 1
Requires
- php: ^8.2
- illuminate/support: ^11.0
- spatie/laravel-package-tools: ^1.9
Requires (Dev)
- laravel/legacy-factories: ^1.0.4
- laravel/octane: ^2.5
- laravel/serializable-closure: ^1.1
- mockery/mockery: ^1.4
- orchestra/testbench: ^9.0
- pestphp/pest: ^2.34
- spatie/valuestore: ^1.2
- dev-main
- 4.0.2
- 4.0.1
- 4.0.0
- v3.x-dev
- 3.2.0
- 3.1.1
- 3.1.0
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- v2.x-dev
- 2.3.9
- 2.3.8
- 2.3.7
- 2.3.6
- 2.3.5
- 2.3.4
- 2.3.3
- 2.3.2
- 2.3.1
- 2.3.0
- 2.2.0
- 2.1.1
- 2.1.0
- 2.0.0
- v1.x-dev
- 1.8.1
- 1.8.0
- 1.7.0
- 1.6.11
- 1.6.10
- 1.6.9
- 1.6.8
- 1.6.7
- 1.6.6
- 1.6.5
- 1.6.4
- 1.6.3
- 1.6.2
- 1.6.1
- 1.6.0
- 1.5.1
- 1.5.0
- 1.4.0
- 1.3.0
- 1.2.0
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.0
- 0.0.3
- 0.0.2
- 0.0.1
This package is auto-updated.
Last update: 2024-11-04 14:43:44 UTC
README
This package can make a Laravel app tenant aware. The philosophy of this package is that it should only provide the bare essentials to enable multitenancy.
The package can determine which tenant should be the current tenant for the request. It also allows you to define what should happen when switching the current tenant to another one. It works for multitenancy projects that need to use one or multiple databases.
Before starting with the package, we highly recommend first watching this talk by Tom Schlick on multitenancy strategies.
The package contains a lot of niceties such as making queued jobs tenant aware, making an artisan command run for each tenant, an easy way to set a connection on a model, and much more.
Are you a visual learner? Then watch this video that covers how you can use laravel-multitenancy and how it works under the hood.
Support us
We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.
We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.
Documentation
You can find the entire documentation for this package on our documentation site.
Testing
You'll need to create the following 3 local MySql databases to be able to run the test suite:
laravel_mt_landlord
laravel_mt_tenant_1
laravel_mt_tenant_2
You can run the package's tests:
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you've found a bug regarding security please mail security@spatie.be instead of using the issue tracker.
Credits
The code of this package is based on the code shown in the Multitenancy in Laravel series by Mohamed Said
Alternatives
License
The MIT License (MIT). Please see License File for more information.