Open-source project
archtechx/tenancy avatar
archtechx/tenancy

stancl/tenancy turns a Laravel app into a multi-tenant app without editing models

Automatic multi-tenancy for Laravel. No code changes needed.

4,433 stars490 forksPHPMIT

At a glance

What is it?
The package identifies tenants by hostname and, per its README, needs no model traits and no replacement of Laravel classes such as Cache or Storage. It is aimed at one Laravel codebase serving many hostnames.
Who is it for?
Adopt it if one Laravel codebase must serve many hostnames and every tenant shares your code, cache and storage setup. Before writing a line of config, open the documentation linked from the README and confirm your Laravel major version is covered there, because the support and donation links on this repository still point at the 3.x branch, and the most recent tag listed is v3.10.1.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 3 days ago.
What is it written in?
Mainly PHP, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • archtechx/tenancy4,433 ★ · +21
Star history
Repository2026-09-232026-11-15
archtechx/tenancy4.4k4.4k

21 Stars in the last 53 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

Hostnames, not model traits, are the entry point

stancl/tenancy identifies a tenant from the request hostname, and the README is explicit that this includes second level domains. That single decision shapes everything else. The README states the approach plainly: no model traits to change the database connection, no replacing of Laravel classes such as Cache or Storage with tenancy-aware versions.

So a team evaluating this package is not rewriting its Eloquent classes. The Eloquent models stay exactly as they are. If your application already works against a single database with a single set of credentials, the work of going multi-tenant is mostly configuration, plus the centralization of anything your app currently hardcodes about its environment.

Config is bootstrapped before your service providers register

The README does not describe the mechanism behind this; it states only that no model traits and no replacement of Laravel classes are needed, and points to the documentation at v4.tenancyforlaravel.com.

One codebase, one worker pool, one runtime

The README does not discuss worker recycling, so check your own queue horizon before assuming a worker will pick up a config change.

The documentation you land on is not the code in this repository

Here is the detail a skim misses. The repository is archtechx/tenancy, but the README links every badge and both support files to stancl/tenancy, and the donation and support links are pinned to the 3.x branch path. The documentation link at the top of the README points at a v4 subdomain, v4.tenancyforlaravel.com, not at the versioned docs for the branch you are reading.

Releases confirm the gap: the most recent listed tags are v3.10.1 from 2026-08-05 and v3.10.0 from 2026-03-18, with v3.9.1 the step before, and the repository has entries such as CLAUDE.md, INTERNAL.md and a Dockerfile that target contributors running the test suite rather than people installing the package. So before you plan an upgrade, resolve the version question yourself. The README does not state which Laravel versions each branch supports. If you are on Laravel 12 and the docs you find are for 3.x, that gap is the first thing to close.

Reading the repository's own test stack as a compatibility list

There is no install command in the README, and the package is distributed through Packagist as stancl/tenancy, which the README links from its badges. The documentation site is the only place install steps are given, so take them from there rather than from a blog post.

The repository's Docker setup is still worth reading, because it doubles as the compatibility statement. The test service builds from a Dockerfile whose default is PHP 8.4, and the compose file starts seven backends before it will run: MySQL 8 twice, Postgres, Redis, MSSQL, Memcached and DynamoDB. Read that as the answer to which database backends the maintainers expect to work. One backend you actually run is enough for a normal application; the rest exist so the package's abstraction layer gets exercised.

A smaller tell sits in the compose file itself, where the MySQL service sets a MYSQL_USER and a MYSQL_USER comment reading redundant. This is a test harness. Do not read it as a deployment template.

Where the single-bootstrap model stops working

Two cases make this the wrong tool, and both come from the same design decision rather than from a rough edge.

First, separate code per tenant. If a customer needs a patched application, a different dependency set, or a version frozen in time, the shared codebase has to carry per-tenant branches.

Second, noisy neighbours. A tenant whose queries saturate the shared PHP-FPM pool or the shared Redis instance affects every other tenant. The README makes no claim about isolation and the repository's test harness gives no evidence of any.

Config centralization is a one-way move

The project is MIT licensed, so commercial use and modification are both permitted.

The real upgrade cost is not the diff. It is that config centralization cannot be undone by removing a package. Moving away from multi-tenancy later is likely to involve a data migration. Plan for that on day one rather than discovering it when a customer wants out.

One more boundary worth knowing before you commit a team to it. The repository keeps its test setup (tests/, phpunit.xml, Dockerfile and docker-compose.yml) alongside the package source. Anyone reading the tree to learn how tenants are separated should look at src/ rather than at the test harness, which is scaffolding, not the integration surface.

Editorial conclusion

Adopt it if one Laravel codebase must serve many hostnames and every tenant shares your code, cache and storage setup. Before writing a line of config, open the documentation linked from the README and confirm your Laravel major version is covered there, because the support and donation links on this repository still point at the 3.x branch, and the most recent tag listed is v3.10.1.

Frequently asked questions

Does stancl/tenancy require adding traits to my Laravel models?

No. The README states that no model traits are needed to change the database connection, and that Laravel classes such as Cache and Storage are not replaced with tenancy-aware versions.

How does stancl/tenancy decide which tenant a request belongs to?

By hostname, using built-in tenant identification that the README says includes second level domains.

What licence is stancl/tenancy released under?

The project is released under the MIT licence, which permits commercial use and modification.

Which database backends does stancl/tenancy support?

The repository's test harness starts MySQL 8, Postgres, Redis, Memcached, MSSQL and DynamoDB, and the Dockerfile installs the pdo_mysql and pdo_pgsql extensions plus redis, memcached and intl.

How do I install stancl/tenancy?

The README gives no install command. It links the package on Packagist as stancl/tenancy and points to the documentation at v4.tenancyforlaravel.com.

Official sources

  1. archtechx/tenancy on GitHub
  2. License: MIT
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/archtechx-tenancy.svg)](https://hysenlabs.com/projects/archtechx-tenancy)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/archtechx-tenancy.svg)](https://hysenlabs.com/projects/archtechx-tenancy)

Was this useful?