Skip to content
CAI
Software that uses CAICheck a score

archtechx/tenancy

60.1

Adequate · 19 September 2026

11.4k

lines of production code

PHP

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

This system is a multi-tenancy framework for Laravel that isolates tenant data and context across databases, caches, sessions, and filesystems. It provides mechanisms for identifying tenants via domains, paths, or request data, and manages the lifecycle of tenant-specific resources including database creation, migrations, and storage symlinks. The package also supports advanced features such as user impersonation, resource syncing between central and tenant contexts, and Row Level Security for PostgreSQL.

How it got here

2019 — Core architecture refactoring and Laravel 13 upgrade

17 changes.

This period focused on a major overhaul of the tenancy core, replacing legacy managers and traits with a new stateful Tenancy class and formalized contract interfaces. The project simultaneously upgraded to Laravel 13 and PHP 8.4, removed deprecated storage drivers, and introduced new features such as user impersonation, cross-domain redirects, and enhanced tenant management commands.

2020 — Core tenancy architecture and resolvers

14 changes.

This period focused on establishing the foundational domain models, event contracts, and tenant identification resolvers for the tenancy system. It introduced comprehensive lifecycle management through queueable jobs, bootstrappers, and listeners, while refactoring database connection handling and query scoping to ensure proper multi-tenant isolation.

2022–2025 — Tenant isolation and resource synchronization

18 changes.

This period focused on strengthening tenant isolation through refined database management interfaces, scoped cache and URL generation, and comprehensive Row-Level Security implementations. It also introduced a robust resource syncing mechanism with dedicated events and listeners to maintain consistency between central and tenant data. Additionally, the work expanded integration capabilities with new bootstrappers for Fortify and Scout, alongside improved tenant key generation and asset serving controls.

Features

Add GlobalCache and Tenancy facades

New facades have been introduced to provide static access to specific services. The GlobalCache facade extends the standard Laravel Cache facade to allow access to the global cache store, ensuring compatibility with the global\_cache() helper. Additionally, a Tenancy facade has been added to provide static access to the main Tenancy service instance.

src/Facades · high confidence

Added Doctum configuration for API documentation generation

The doctum directory now includes a configuration file (doctum.php) and a .gitignore to support generating API documentation for the Tenancy for Laravel project. The configuration sets up Doctum to scan PHP files in the src directory, defines version support for 1.x, 2.x, 3.x, and master, and configures build and cache directories. It also specifies the documentation title, base URL, and integrates with GitHub for remote repository links.

doctum · high confidence

Added tenant-aware impersonation token storage schema

The system now includes a dedicated database migration to create the \tenant\_user\_impersonation\_tokens\ table, enabling persistent storage of impersonation sessions scoped to specific tenants. This table stores the impersonation token, associated user ID, authentication guard, redirect URL, and a 'remember' flag, with a foreign key linking to the tenant table to ensure multi-tenant isolation.

assets/impersonation-migrations · high confidence

Initial tenant and domain schema migrations

Added new migration files to define the core tenancy database structure. The \tenants\ table now includes a primary \id\, standard timestamps, and a nullable \data\ JSON column for custom attributes. The \domains\ table maps domains to tenants using a foreign key on the configurable tenant key column, with cascade updates enabled to maintain referential integrity.

assets/migrations · high confidence

Introduction of Context and RouteMode enums

New enum classes have been added to the \Stancl\\Tenancy\\Enums\ namespace to define tenancy context and routing modes. The \Context\ enum provides \TENANT\ and \CENTRAL\ cases to distinguish between tenant and central environments. The \RouteMode\ enum introduces integer-backed cases (\CENTRAL\, \TENANT\, \UNIVERSAL\) using bitwise values to control routing behavior, with a note that these backing values are not part of the public API.

src/Enums · high confidence

New TenantAssetController with configurable headers and middleware

A new TenantAssetController has been added to serve tenant assets from the public storage directory. This controller allows users to specify custom response headers via a static property or closure and apply additional middleware to the asset-serving route, providing greater control over how tenant files are delivered.

src/Controllers · high confidence

New abstract CachedTenantResolver base class with cache invalidation support

Introduces an abstract \CachedTenantResolver\ class in the contracts namespace that provides a standardized caching layer for tenant resolution. This base class handles cache lookups, storage with configurable TTL, and, crucially, a new \invalidateCache()\ method that allows clearing cached tenant entries by iterating through possible cache keys. Subclasses must implement \resolveWithoutCache\ and \getPossibleCacheKeys\ to define specific resolution logic and cache key generation, enabling consistent caching behavior across different resolver implementations while supporting cache invalidation scenarios.

src/Resolvers/Contracts · high confidence

New abstract event contracts for domain, tenancy, and tenant contexts

The library introduces three new abstract base classes in the \src/Events/Contracts\ namespace to standardize event structures: \DomainEvent\, \TenancyEvent\, and \TenantEvent\. \DomainEvent\ and \TenantEvent\ both utilize Laravel's \SerializesModels\ trait and accept their respective model instances (\Domain\ and \Tenant\) via constructor injection, while \TenancyEvent\ accepts a \Tenancy\ instance. These contracts provide a consistent foundation for future domain-specific events.

src/Events/Contracts · high confidence

New and refactored tenant database managers for SQL Server, MySQL, PostgreSQL, and SQLite

The \src/Database/TenantDatabaseManagers\ directory now contains dedicated managers for Microsoft SQL Server, MySQL, PostgreSQL (both database and schema modes), and SQLite, along with permission-controlled variants for SQL Server, MySQL, and PostgreSQL. These classes handle tenant database creation, deletion, and existence checks using database-specific SQL syntax (e.g., \CREATE DATABASE\, \DROP SCHEMA\, named in-memory SQLite support). The permission-controlled managers additionally implement user creation and deletion with specific grant sets (e.g., \SELECT\, \INSERT\ for SQL Server; full CRUD and routine grants for MySQL; \CONNECT\, \USAGE\, \CREATE\ for PostgreSQL). SQLite support now includes named in-memory database handling via closures for connection persistence. All managers validate database names and parameters before execution.

src/Database/TenantDatabaseManagers · high confidence

New bootstrappers for Fortify tenant redirects and Scout prefixing

Added FortifyRouteBootstrapper and ScoutPrefixBootstrapper to the integrations layer. The Fortify bootstrapper allows customizing Laravel Fortify action redirects to point to tenant-specific routes and optionally passes tenant parameters based on the identification method (path/query vs domain). The Scout bootstrapper dynamically sets the Scout index prefix to the tenant key during tenancy, ensuring search results are scoped correctly per tenant.

src/Bootstrappers/Integrations · high confidence

New contract interfaces for tenancy core components

This change introduces a set of new PHP interfaces in the \src/Contracts\ directory to define the core abstractions of the tenancy system. Specifically, it adds \Tenant\, \Domain\, \Feature\, \TenancyBootstrapper\, \TenantResolver\, and \UniqueIdentifierGenerator\ interfaces, along with \SingleDomainTenant\ and two exception classes (\TenantCannotBeCreatedException\, \TenantCouldNotBeIdentifiedException\). These contracts formalize the expected behavior for tenant identification, domain association, feature bootstrapping, resolver logic, and ID generation, providing a structured API for implementing tenancy-specific logic.

src/Contracts · high confidence

New developer tooling and configuration scaffolding

The repository now includes a comprehensive set of development infrastructure files to streamline local setup and code quality. A Docker-based testing environment is introduced via a new Dockerfile (supporting PHP 8.4/8.5 and multiple database drivers like MySQL, PostgreSQL, and SQL Server) and a docker-compose.yml for orchestrating services. Developer workflows are enhanced with shell scripts for running tests (\./test\, \./t\), a PHP CS Fixer configuration (\.php-cs-fixer.php\), and a PHPStan configuration (\phpstan.neon\) set to level 8. Documentation for contributors is added through \CONTRIBUTING.md\, \SUPPORT.md\, and \CLAUDE.md\, while \.gitattributes\ and \.gitignore\ are updated to manage exports and ignore generated artifacts.

(repo-wide) · high confidence

New domain, impersonation, and tenant model implementations

The package now includes concrete Eloquent models for core tenancy concepts. The new Domain model manages domain-to-tenant mappings, automatically converting domains to lowercase and dispatching lifecycle events. The ImpersonationToken model enables user impersonation across tenants, requiring stateful guards and storing token details in a dedicated table. The Tenant model serves as the base for tenant entities, providing methods to retrieve the current tenant, handling custom primary keys, and dispatching tenancy-specific events.

src/Database/Models · high confidence

New event classes for resource syncing lifecycle

The ResourceSyncing module now includes a set of new event classes to track the lifecycle of synced resources. These include CentralResourceAttachedToTenant and CentralResourceDetachedFromTenant for central resource associations, SyncMasterDeleted and SyncMasterRestored for master resource state changes, and SyncedResourceSaved, SyncedResourceDeleted, and SyncedResourceSavedInForeignDatabase for individual synced resource actions. These events provide hooks for listeners to react to specific syncing operations.

src/ResourceSyncing/Events · high confidence

New resource syncing listeners for central-tenant synchronization and cleanup

This change introduces a suite of new event listeners in the ResourceSyncing module to manage bidirectional synchronization between central and tenant resources. The \UpdateOrCreateSyncedResource\ listener handles the core logic for keeping central and tenant records in sync upon save, including attaching/detaching tenant mappings. New listeners \CreateTenantResource\, \DeleteResourceInTenant\, \DeleteResourcesInTenants\, and \RestoreResourcesInTenants\ manage the lifecycle of tenant-side resources when central resources are created, deleted, or restored. Additionally, \DeleteResourceMapping\ and \DeleteAllTenantMappings\ ensure that pivot records are correctly cleaned up when resources or entire tenants are deleted, preventing orphaned data.

src/ResourceSyncing/Listeners · high confidence

New tenancy concerns for migrations, route contexts, and parallel commands

This update introduces several new traits in the \src/Concerns\ directory to enhance tenancy management. \DealsWithMigrations\ allows commands to target tenant-specific migration paths. \DealsWithRouteContexts\ provides logic to determine if a route is central, tenant, or universal, handling middleware stacking and identification priorities. \ParallelCommand\ adds support for executing commands across multiple tenants concurrently using process forking, with automatic core detection and configurable process limits. \HasTenantOptions\ adds standard CLI options (\--tenants\, \--skip-tenants\, \--with-pending\) to filter tenant execution. \ManagesRLSPolicies\ simplifies dropping Row Level Security policies in PostgreSQL. \TenantAwareCommand\ and \ExtendsLaravelCommand\ streamline the creation of commands that run against specific tenants. \UsableWithEarlyIdentification\ helps identification middleware decide whether to skip execution based on route context and existing identification methods.

src/Concerns · high confidence

New tenancy features: cross-domain redirects, SQLite security, Vite bundling, and user impersonation

The \src/Features\ directory now includes several new feature implementations. \CrossDomainRedirect\ adds a \domain()\ macro to \RedirectResponse\ to automatically update the hostname in redirect URLs for the current tenant. \DisallowSqliteAttach\ prevents SQLite \ATTACH DATABASE\ operations to improve security, using a native authorizer on PHP 8.5+ or a custom extension on earlier versions. \ViteBundler\ configures Laravel Vite to resolve assets via \global\_asset()\ instead of tenant-specific paths. \UserImpersonation\ introduces a token-based system allowing users to impersonate other users within a tenant context, with session-based guard tracking and configurable TTL. \TelescopeTags\ automatically tags Laravel Telescope entries with the current tenant ID. \TenantConfig\ (now deprecated in favor of \TenantConfigBootstrapper\) allows mapping tenant storage keys to application config values, applying them on tenancy boot and reverting on context switch.

src/Features · high confidence

New tenancy lifecycle and maintenance mode events

The \src/Events\ directory now includes a comprehensive set of new event classes covering the full tenancy lifecycle, including bootstrapping, initialization, domain and database operations (creation, migration, seeding, deletion), and storage symlink management. Additionally, new \TenantMaintenanceModeEnabled\ and \TenantMaintenanceModeDisabled\ events have been added to allow listeners to react when a tenant enters or exits maintenance mode.

src/Events · high confidence

New tenant key identifier generators added

Added new implementations for generating tenant keys, including RandomHexGenerator, RandomIntGenerator, RandomStringGenerator, ULIDGenerator, UUIDGenerator, and UUIDv7Generator. These provide users with additional options for creating unique identifiers for tenants, supporting various formats such as hexadecimal strings, integers, random strings, ULIDs, UUIDs, and UUIDv7s.

src/UniqueIdentifierGenerators · high confidence

New tenant resolvers for domain, path, and request data identification

The \src/Resolvers\ directory now includes three new tenant identification strategies: \DomainTenantResolver\ identifies tenants by matching the request domain against stored domain records (supporting both single-domain and multi-domain tenants), \PathTenantResolver\ identifies tenants via a configurable route parameter (defaulting to 'tenant') and automatically forgets this parameter after resolution to keep route actions clean, and \RequestDataTenantResolver\ identifies tenants using configurable headers, query parameters, or cookies. All three extend the cached resolver base class, allowing for configurable cache behavior and cache key generation based on the specific identification method used.

src/Resolvers · high confidence

New tenant-aware bootstrappers for broadcasting, caching, logging, and sessions

This release introduces a suite of new bootstrappers in the \src/Bootstrappers\ directory to provide finer control over how tenant context affects various Laravel subsystems. Broadcasting is now handled by \BroadcastingConfigBootstrapper\ (which maps tenant credentials to config and rebinds the manager) and \BroadcastChannelPrefixBootstrapper\ (which prefixes channel names with the tenant key for Pusher, Reverb, and Ably). Caching is split into \CacheTenancyBootstrapper\ (prefix-based separation), \DatabaseCacheBootstrapper\ (switches database cache stores to the tenant connection), and \CacheTagsBootstrapper\ (legacy tag-based separation). Session handling is improved with \DatabaseSessionBootstrapper\ to ensure the database session driver uses the correct tenant connection. Logging is scoped via \LogChannelBootstrapper\, which configures channels to write to tenant-specific storage paths or apply custom overrides. Additionally, \DatabaseTenancyBootstrapper\ now includes a \harden\ mode to prevent cross-tenant database access, and \FilesystemTenancyBootstrapper\ has been updated to support scoped disks and improved asset URL handling.

src/Bootstrappers · high confidence

Removals

Removal of BootstrapsTenancy trait

The BootstrapsTenancy trait has been removed from the codebase. This trait previously handled the initialization of tenancy by switching database connections, configuring Redis prefixes, tagging cache, and suffixing filesystem root paths. Its removal indicates a shift in how tenancy bootstrapping is managed, likely moving this logic to a different component or service provider.

src/Traits · high confidence

Removal of Redis storage driver

The Redis storage driver implementation has been removed from the codebase. This eliminates the ability to use Redis as a backend for storing tenant data and configuration, requiring users to switch to alternative storage drivers such as the database driver if they were previously relying on Redis for tenancy persistence.

src/StorageDrivers · high confidence

Removal of StorageDriver interface

The StorageDriver interface has been removed from the codebase. This interface previously defined the contract for storage operations, including methods for identifying tenants, retrieving tenant data, and performing basic key-value storage operations (get/put). Its removal indicates a shift in how storage interactions are handled, likely moving towards a different abstraction or implementation strategy.

src/Interfaces · high confidence

Behavioural changes

Add DisallowSqliteAttach feature

A new SQLite extension has been added to the extensions directory that disables the SQLite ATTACH command. The C source code implements an authorizer that explicitly denies the SQLITE\_ATTACH action, and the accompanying Makefile provides build instructions for generating the shared library (DLL, dylib, or SO) across Windows, macOS, and Linux platforms.

extensions · high confidence

Introduction of tenant resource mapping table

A new database migration has been added to create the \tenant\_resources\ table, which stores mappings between tenants and their associated resources. This table includes columns for the tenant ID, the resource's global ID, and a type field intended to support polymorphic relationships, enabling the system to link specific resource types to individual tenants.

assets/resource-syncing-migrations · high confidence

Major overhaul of tenant management commands with parallel execution and new capabilities

The \src/Commands\ directory has been significantly refactored and expanded. Migration commands (\tenants:migrate\, \tenants:rollback\, \tenants:migrate-fresh\) now support parallel execution via a \--processes\ option and include a \--skip-failing\ flag to continue on errors. New commands have been added: \tenants:pending-create\ and \tenants:pending-clear\ for managing pending tenants, \tenants:down\ and \tenants:up\ for putting tenants into and out of maintenance mode, \tenants:purge-impersonation-tokens\ to clear expired tokens, \tenants:rls\ to create Row Level Security policies for PostgreSQL, and \tenant:tinker\ for interactive tenant shells. The \tenants:link\ command now supports removing symlinks, and \tenants:install\ has been rewritten to use a structured step-based installer. Additionally, \tenants:migrate-fresh\ now optionally drops tenant databases if configured, and \tenants:seed\ has been updated to support Laravel 13.24+ signature syntax.

src/Commands · high confidence

New specific exceptions for tenant identification and validation errors

The library now introduces a suite of granular exception classes in the \Stancl\\Tenancy\\Exceptions\ namespace to provide clearer error reporting during tenant resolution. New exceptions include \DomainOccupiedByOtherTenantException\ and \NotASubdomainException\ for domain validation, \RouteIsMissingTenantParameterException\ for route configuration issues, and \StatefulGuardRequiredException\ for authentication guard constraints. Additionally, identification failures are now categorized by source with \TenantCouldNotBeIdentifiedByIdException\, \TenantCouldNotBeIdentifiedByPathException\, \TenantCouldNotBeIdentifiedByRequestDataException\, and \TenantCouldNotBeIdentifiedOnDomainException\, all extending \TenantCouldNotBeIdentifiedException\, alongside \TenantColumnNotWhitelistedException\ for database column restrictions and \TenancyNotInitializedException\ for general initialization states.

src/Exceptions · high confidence

New tenancy lifecycle listeners and queueable listener base class

The \src/Listeners\ directory now contains a set of new event listeners that manage the tenancy lifecycle and database connections. \BootstrapTenancy\ and \RevertToCentralContext\ handle the initialization and teardown of tenancy bootstrappers, ensuring they are only reverted if they were previously initialized. \CreateTenantConnection\ and \UseTenantConnection\ manage switching the database connection to the tenant context, while \UseCentralConnection\ reverts it to the central database. \ForgetTenantParameter\ cleans up the tenant parameter from route matches when using kernel-based path identification. Additionally, \CreateTenantStorage\ and \DeleteTenantStorage\ are introduced to manage tenant-specific storage directories, with \DeleteTenantStorage\ checking configuration to avoid accidental central storage deletion. A new \QueueableListener\ abstract class is provided to allow listeners to be optionally queued via a static \$shouldQueue\ flag.

src/Listeners · high confidence

Refactored RLS policy generation with comment-based constraints and new manager classes

The Row-Level Security (RLS) policy generation logic has been restructured into dedicated manager classes: TableRLSManager handles database schema analysis to generate policies based on foreign key paths, while TraitRLSManager discovers Eloquent models to generate policies based on traits like BelongsToTenant. A new RLSCommentConstraintException was added to handle malformed constraints, and the system now supports skipping foreign keys marked with a 'no-rls' comment, allowing users to explicitly exclude specific relationships from RLS scoping.

src/RLS · high confidence

Refactored database concerns into new traits and scope

The database concerns in this namespace have been reorganized into a set of new, focused traits and a scope class. This includes new traits for managing tenant relationships (BelongsToTenant, BelongsToPrimaryModel), database configuration and connections (HasDatabase, CentralConnection, TenantConnection), domain handling (HasDomains, ConvertsDomainsToLowercase, EnsuresDomainIsNotOccupied), and tenant lifecycle management (HasPending, MaintenanceMode, InitializationHelpers). Additionally, new traits handle specific operational concerns like generating IDs (GeneratesIds), filling current tenant context (FillsCurrentTenant), managing Postgres users (ManagesPostgresUsers, CreatesDatabaseUsers), validating database parameters (ValidatesDatabaseParameters), and invalidating resolver caches (InvalidatesResolverCache, InvalidatesTenantsResolverCache). A new PendingScope class manages query scoping for pending tenants, and an RLSModel interface is introduced for Row Level Security integration.

src/Database/Concerns · high confidence

Refactored database connection management and tenant scoping

The database layer has been restructured to improve how tenant connections are managed and how queries are scoped. A new DatabaseConfig class centralizes the logic for generating database names, usernames, and passwords, and now supports defining the tenant connection template using array syntax in the configuration. The DatabaseManager has been refactored to handle connection creation and purging more cleanly, ensuring the default connection switches correctly between central and tenant databases. Additionally, new global scopes (TenantScope and ParentModelScope) automatically filter queries by the current tenant or its parent model, with helper macros like withoutTenancy and withoutParentModel to bypass these filters when needed. A TenantCollection class was also added to allow running callbacks for multiple tenants at once.

src/Database · high confidence

The \src/Actions\ directory has been restructured into dedicated action classes to improve how tenant routes are cloned and storage symlinks are managed. The new \CloneRoutesAsTenant\ action provides a fluent API for cloning routes, allowing users to specify which middleware triggers cloning, customize the addition of tenant parameters and middleware, and control domain scoping for cloned routes. Additionally, \CreateStorageSymlinksAction\ and \RemoveStorageSymlinksAction\ now handle the creation and removal of tenant-specific storage symlinks, emitting events during the process to allow for further customization or logging.

src/Actions · high confidence

Refactored tenancy core to use a stateful Tenancy class and new exception types

The tenancy system has been refactored to replace the legacy TenantManager, DatabaseManager, and CacheManager with a new stateful Tenancy class that manages initialization, bootstrapping, and context switching. This change introduces specific exception classes for database management scenarios, including DatabaseManagerNotRegisteredException, NoConnectionSetException, RecursiveRelationshipException, TableNotRelatedToTenantException, TenantDatabaseAlreadyExistsException, TenantDatabaseDoesNotExistException, and TenantDatabaseUserAlreadyExistsException. The service provider now registers these new components and updates command bindings, while helper functions like tenancy(), tenant(), and global\_cache() are updated to interact with the new architecture.

src · high confidence

Refactored tenancy identification and session scoping middleware

The middleware layer has been restructured to support multiple tenant identification strategies (domain, subdomain, path, request data, and origin header) through a unified abstract base class, replacing the previous generic InitializeTenancy middleware. This change introduces specific middleware classes for each identification method, allowing users to choose how tenants are resolved. Additionally, the ScopeSessions middleware now enforces that tenancy is initialized before session scoping occurs, throwing an exception if the order is incorrect, and the PreventAccessFromUnwantedDomains middleware now correctly handles universal routes to prevent access mismatches between central and tenant contexts.

src/Middleware · high confidence

Refactored tenant database management interfaces

The tenant database management contracts have been restructured to improve separation of concerns and state management. A new \TenantDatabaseManager\ interface now handles core database lifecycle operations (create, delete, existence checks) and connection configuration. A separate \ManagesDatabaseUsers\ interface has been introduced to isolate user management tasks (create, delete, existence checks). Additionally, a \StatefulTenantDatabaseManager\ interface provides methods for getting and setting a persistent database connection, while the \TenantWithDatabase\ interface ensures tenants expose their database configuration. This change affects how database and user operations are abstracted for tenant-aware applications.

src/Database/Contracts · high confidence

Removal of default tenancy configuration file

The default configuration file for the tenancy package (\src/config/tenancy.php\) has been removed. This file previously defined default settings for storage drivers, database prefixes and suffixes, Redis and cache key prefixes, and filesystem disk suffixes. Users relying on these defaults will need to provide their own configuration or ensure the package is configured via other means, as the built-in fallback configuration is no longer present.

src/config · high confidence

Resource syncing rework with new pivot interfaces and event handling

The resource syncing mechanism has been restructured to improve how central resources are attached to tenants. A new \PivotWithCentralResource\ interface allows pivot models to explicitly define the central resource class, while \TenantMorphPivot\ and \TenantPivot\ now use the \TriggerSyncingEvents\ trait to handle attach/detach lifecycle events. The \ResourceSyncing\ trait introduces new events (\SyncedResourceDeleted\, \SyncMasterDeleted\, etc.) and enforces that central resources are accessed via the central model's \tenants()\ relationship, throwing \CentralResourceNotAvailableInPivotException\ if the pivot context is ambiguous or missing the central resource.

src/ResourceSyncing · high confidence

Tenant lifecycle operations are now queueable jobs

Database creation, deletion, migration, seeding, and storage management for tenants are now executed via dedicated queueable jobs (e.g., CreateDatabase, DeleteDatabase, MigrateDatabase, SeedDatabase, CreateStorageSymlinks, DeleteTenantStorage). This allows these operations to be processed asynchronously, improving application responsiveness during tenant setup and teardown. The jobs include configurable behaviors such as skipping database deletion when creation was skipped, ignoring failures during deletion, and controlling whether pending tenants are included in migration and seeding operations.

src/Jobs · high confidence

Tenant-aware URL generation and cache tagging

The package now automatically scopes cache operations and URL generation to the current tenant. A new CacheManager override ensures all cache calls are prefixed with the tenant key, preventing data leakage between tenants. Additionally, the TenancyUrlGenerator overrides Laravel's URL generation to automatically append the tenant parameter to routes (or prefix route names) when in a tenant context, ensuring generated links point to the correct tenant scope while allowing bypass via a specific parameter.

src/Overrides · high confidence

Updated tenancy scaffolding with new identification and asset routing defaults

The package's default scaffolding files have been updated to reflect the current tenancy configuration. The \TenancyServiceProvider.stub.php\ now includes a comprehensive set of event listeners for tenant lifecycle, domain management, and resource syncing. The \config.php\ has been restructured to define identification middleware (domain, subdomain, path, request data, origin header) and tenant resolvers with caching options. Additionally, new \routes.php\ and \tenant\_routes.stub.php\ files are introduced to handle tenant-specific asset serving via a dedicated controller and to provide a default route group with domain identification and session scoping middleware.

assets · high confidence

Test coverage

Added FFI stub for IDE support; Added comprehensive test coverage for tenancy bootstrappers; Added feature tests for tenancy security, configuration, and Vite integration; Added test fixtures and stubs for the tests/Etc directory; Added test migration for tenant users table; Added tests for Postgres RLS policy management; Comprehensive test suite for tenancy core features.

Dependencies

Upgrade to Laravel 13 and PHP 8.4 with updated dependencies

The package now requires PHP 8.4 and supports Laravel 12 and 13, replacing the previous Laravel 5.7 constraint. Key dependency changes include switching from \webpatser/laravel-uuid\ to \ramsey/uuid\ v4.7.3, updating \stancl/jobpipeline\ to v2.0.0-rc7, and adding \laravel/prompts\, \spatie/invade\, and \laravel/tinker\. Test tooling has been updated to use Pest v4 and Larastan v3, and the \Tenancy\ and \GlobalCache\ facades are now explicitly registered in the service provider aliases.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Baseline

  • First survey — no prior run to compare against. CAI 60.

Lenses

  • Code Health 98
  • Architecture 97
  • Maturity 60
  • Readiness 45
  • Security 78

Changes since last survey

  • 300 commits — 229 feature/other, 71 fixes

By area

  • (root) — 44 commits
  • src/Database — 33 commits
  • src/Bootstrappers — 31 commits
  • (repo) — 19 commits
  • src/Commands — 19 commits
  • src/Middleware — 14 commits
  • assets/TenancyServiceProvider.stub.php — 13 commits
  • assets/config.php — 13 commits
  • src/Concerns — 12 commits
  • .github/workflows — 11 commits
  • src/ResourceSyncing — 10 commits
  • src/Actions — 9 commits
  • src/Resolvers — 7 commits
  • src/Tenancy.php — 7 commits
  • src/Controllers — 6 commits
  • src/Features — 6 commits
  • src/Jobs — 6 commits
  • tests/Bootstrappers — 6 commits
  • src/UniqueIdentifierGenerators — 5 commits
  • src/Listeners — 4 commits

Notable commits

  • fix: Fix #1404: support universal routes in CheckTenantForMaintenanceMode
  • fix: Fix assert: run createDatabase() outside assert()
  • fix: Fix chaining withoutPending() with where() (#1457)
  • fix: Fix code style (php-cs-fixer)
  • fix: Fix code style (php-cs-fixer)
  • fix: Fix code style (php-cs-fixer)
  • fix: Fix code style (php-cs-fixer)
  • fix: Fix code style (php-cs-fixer)
  • fix: Fix code style (php-cs-fixer)
  • fix: Fix code style (php-cs-fixer)
  • fix: Fix code style (php-cs-fixer)
  • fix: Fix code style (php-cs-fixer)
  • fix: Fix code style (php-cs-fixer)
  • fix: Fix code style (php-cs-fixer)
  • fix: Fix code style (php-cs-fixer)
  • fix: Fix code style (php-cs-fixer)
  • fix: Fix cookie identification (#56)
  • fix: Fix duplicate entry error when updating TenantPivot columns (#1469)
  • fix: Fix exception message
  • fix: Fix global/central channel terminology
  • …and 280 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

archtechx/tenancy was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 52f97c1f6a266a5bf99e8c776b215b34412d2c73 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.