New version 3

Tenancy for Laravel

A flexible multi-tenancy package for Laravel. Single & multi-database tenancy, automatic & manual mode, event-based architecture. Integrates perfectly with other packages.

A package that fits your needs

stancl/tenancy is a flexible multi-tenancy Laravel package that comes with lots of features out-of-the-box and doesn't stand in your way when you need anything custom.

Automatic tenancy

Instead of forcing you to change how you write your code, the package by default bootstraps tenancy automatically, in the background. Database connections are switched, caches are separated, filesystems are prefixed, etc.

  • Automatic data separation

    Out of the box, the package makes the following things tenant-aware: databases, caches, filesystems, queues, redis stores. This means that if you've already written your app and are looking to make it multi-tenant, you don't have to change anything!

  • Integrates with other packages

    Since the automatic mode changes the default database connection, most other packages will use this connection too. This means that you can do awesome things such as using Laravel Nova inside the tenant application to manage the tenant's resources.

  • Fully testable

    Many other tenancy packages have a terrible track record when it comes to testability. We find that unacceptable. With this package, you can test everything. The central application, the tenant application, and everything in between — including the tenant registration flow.

Tenant controller

Extreme flexibility

Version 3 is heavily focused on flexibility, but without sacrificing features. Even though everything is customizable, the defaults will likely suit you for the large part.

  • Event-based architecture

    All of the tenancy bootstrapping logic, post-tenant-creation logic, and most other things, happen as a result of events firing. You can customize every single bit.

  • Single or multi-database tenancy

    Don't want to use the database-per-tenant approach? No problem, we provide you with model traits for scoping models to the current tenant, including models that aren't related to the tenant directly.

  • Manual tenancy

    Prefer specifying database connections instead of changing the default connection? No problem, we have model traits prepared.

Tenancy events

Packed with features

This package has the most features out of all multi-tenancy packages for Laravel.

Shared users between tenants

Need to use the database-per-tenant approach but also need to have users that belong to multiple tenants? We've got you covered. Our Resource Syncing feature lets you synchronize any database resources between specific tenants' databases.

User impersonation

Want to impersonate a user inside a tenant's database from the central context? Or even from another tenant's context? Just enable the user impersonation feature in the config.

Works with any database

Need to separate tenant databases on MySQL/PostgreSQL/SQLite? No problem. Or maybe you want to use PostgreSQL schemas instead? We can do that too.

Ready to try it?

Read the documentation.

Awesome integration with other packages

Apart from saving you a huge amount of time, the automatic mode has another great side effect: it lets you integrate almost any other package with no issues. No more model traits!


Trusted by developers

This package powers many production applications on many different hosting platforms.

Stars on GitHub
600 000+
Sponsors <3

“Tenancy for Laravel allowed us to effortlessly and quickly integrate the needed landlord/tenant functionality for our SaaS platform. It fits our needs perfectly.”


“This package enabled us to abstract all the context switching to focus our development efforts elsewhere. That resulted in significant performance increase. The event driven architecture is powerful, flexible and bends to all our needs.”

Want updates about big releases and product launches?

Sign up for our newsletter.

Frequently asked questions

Yes! The package is in its third major version and has been stable since February 2019. Many people are using it in production.

Subscribe to our newsletter

Receive notifications about important releases, new packages and other updates.

Made by ArchTech. © 2024 All rights reserved.

Save time with our SaaS application template.