stancl/tenancy
Automatic multi-tenancy for Laravel with no code changes needed. Database-per-tenant, hostname and subdomain identification, and no model traits or class swapping. Docs at tenancyforlaravel.com.
tenant_id on every row), schema-per-tenant (Postgres), and database-per-tenant is usually a one-way door — stancl/tenancy reduces the cost of that door by handling connection switching, tenant-aware cache/storage/filesystem, and queue context automatically, so a DB-per-tenant or hybrid model becomes a configuration choice rather than a rewrite. It also lets you start shared-schema for self-serve and offer dedicated databases as a premium tier without a second codebase.tenants:migrate, migrate-fresh --step), connection bootstrapping, queue worker context reverting, tenant asset serving, impersonation for support — ships in the box under MIT. That is typically weeks of senior engineering plus indefinite maintenance for a non-differentiating capability.Adopt when:
Look elsewhere when:
tenant_id and global scopes is sufficient. The package's core value is connection-level isolation; if you don't need it, a scoped-model approach is simpler and cheaper to reason about.Two signals to discount in the scoring: the "0 dependents" figure is a registry artifact rather than evidence of low use, and the low opportunity score (40.89) reflects a mature, well-served category, not a weak package. Overall score of 63 is consistent with "safe, proven default with maintainer-concentration risk."
To executives: We can sell to customers who require data isolation — the single most common blocker in enterprise SaaS deals — without building a second product. stancl/tenancy is the de facto standard for multi-tenancy in Laravel: 4,400+ GitHub stars, MIT licensed, actively released through August 2026 with support for current Laravel versions, and a track record of steady patch releases across five major Laravel upgrades. Buying this instead of building it removes an estimated several engineer-months of non-differentiating work and, more importantly, removes it from the critical path of the enterprise tier. The residual risk is concentration: one primary maintainer, no commercial SLA, documentation split between the 3.x and 4.x lines. We mitigate with version pinning, our own integration test suite, and a documented fork path — standard practice for open-source infrastructure and cheaper than the alternative.
To engineering: It's designed to be invisible — no model traits to change connection, no swapping Laravel facades for tenancy-aware variants; tenant identification is hostname-based out of the box and context switching is handled by bootstrappers. It already covers the parts teams usually get wrong: queue workers reverting to central context, taggable cache, tenant-aware filesystem and asset serving, per-tenant migration and seeding commands, MariaDB and Postgres schema managers, and impersonation. Your adoption work is configuration, DNS/TLS for wildcard subdomains, and a migration story for existing tenants — not a refactor. We should still own the cross-tenant reporting layer and the provisioning pipeline, which are out of scope.
How can I help you explore Laravel packages today?