semitexa/tenancy

Semitexa Tenancy - tenant resolution, scoped context, and multi-tenant application support

Maintainers

Package info

github.com/semitexa/semitexa-tenancy

Type:semitexa-module

pkg:composer/semitexa/tenancy

Statistics

Installs: 76

Dependents: 8

Suggesters: 1

Stars: 0

Open Issues: 0

2026.04.05.0855 2026-04-04 13:59 UTC

README

Tenant resolution, scoped context, and multi-tenant application support.

Purpose

Resolves the current tenant per request through a configurable chain of strategies (path, subdomain, header, query param). Stores the resolved tenant in coroutine-safe context for downstream use by ORM, Cache, Storage, and other tenant-aware packages.

Role in Semitexa

Depends on Core. Depended on by ORM, Cache, Search, Media, Scheduler, Workflow, and optionally Locale. Tenancy is foundational to the multi-tenant architecture — when active, ORM scopes queries, Cache namespaces keys, and Storage isolates paths, all transparently based on the resolved tenant.

Key Features

  • TenancyBootstrapper builds resolver chain from env config
  • Resolution strategies: path, subdomain, header, query param
  • TenantContext with coroutine-safe CoroutineContextStore
  • TenantResolverChain composable resolver ordering
  • Multi-layer tenancy via LayerDefinition
  • #[AsTenantLayerStrategy] attribute for custom layers
  • TenantRepositoryInterface for tenant lookup (config or database-backed)