New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

spatie/laravel-multitenancy

Make your Laravel app usable by multiple tenants
5,086,037 1,375

Larablocks Analysis

Compatibility

Trusted maintainer

spatie/laravel-multitenancy works with Laravel 12 and 13 (latest release 4.3.2, Nov 26, 2026).

Laravel 7 to 11 in earlier releases.

  • Trusted maintainer: spatie publishes 287 packages on Larablocks, with 204,166,383 downloads a month between them.

Recommendation checks

Recommended

Recommended by Larablocks: meets all 4 checks.

  • Works with Laravel 13, the current version
  • Released in the last 12 months (Nov 26, 2026)
  • 522,039 downloads a month (at least 10,000)
  • 1,375 GitHub stars (at least 100)

State

Actively maintained
  • Last stable release: Nov 26, 2026.
  • 15 releases in the last 12 months.
  • First released: May 5, 2020.
  • Monthly downloads: 522,039, up 204% from six months ago.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Dec 1, 2026.

Install
composer require spatie/laravel-multitenancy
Latest Version:4.3.2
PHP:^8.3
Laravel:12 · 13
Older releases:7 – 11
License:MIT
Last Updated:Dec 1, 2026
Links: GitHub  ·  Packagist
Maintainer: spatie
Logo for laravel-multitenancy

Unopinionated multitenancy package for Laravel

Latest Version on Packagist GitHub Tests Action Status Total Downloads

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

The cache tests also require Redis and the PHP Redis extension. To include the real HTTP tests for Octane, download RoadRunner after installing the Composer dependencies:

vendor/bin/rr get-binary --no-config -n

Without the RoadRunner binary, those HTTP tests are skipped. CI always installs it.

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.

Related Packages

spatie/elasticsearch-search-string-parser

Build Elasticsearch queries based of a query string

24,619 51
spatie/backtrace

A better backtrace

220,267,784 438
spatie/laravel-package-tools

Tools for creating Laravel packages

208,094,001 952
spatie/image-optimizer

Easily optimize images using PHP

100,292,189 2,882
spatie/error-solutions

This is my package error-solutions

92,435,565 67

Version History

Version Released PHP Laravel License
4.3.2 ^8.3 ^12.0|^13.0 MIT
4.3.1 ^8.3 ^12.0|^13.0 MIT
4.3.0 ^8.3 ^12.0|^13.0 MIT
4.2.3 ^8.3 ^12.0|^13.0 MIT
4.2.2 ^8.3 ^12.0|^13.0 MIT