TenantResolutionMiddleware
in package
implements
MiddlewareInterface
Table of Contents
Interfaces
- MiddlewareInterface
Properties
- $connectionManager : TenantConnectionManager
- $enabled : bool
- $operationalMetrics : TenantOperationalMetricsService|null
- $platformHealth : PlatformHealthCheckerInterface|null
- $requiredSchemaVersion : string
- $tenantHostResolver : TenantHostResolver|null
Methods
- __construct() : mixed
- Constructor.
- process() : ResponseInterface
- Resolve the request host to a tenant and bind tenant context for the request.
- handlePlatformAdminHost() : ResponseInterface
- Allow the dedicated platform-admin host to bypass tenant DB binding.
- isPlatformAdminHost() : bool
- Check whether a request host is reserved for the platform-admin portal.
- recordOperationalMetric() : void
- Record a privacy-safe request aggregate without affecting the response.
- routeName() : string
- Build a route identifier without IDs, query strings, or request data.
Properties
$connectionManager read-only
private
TenantConnectionManager
$connectionManager
$enabled read-only
private
bool
$enabled
$operationalMetrics read-only
private
TenantOperationalMetricsService|null
$operationalMetrics
= null
$platformHealth read-only
private
PlatformHealthCheckerInterface|null
$platformHealth
= null
$requiredSchemaVersion read-only
private
string
$requiredSchemaVersion
= ''
$tenantHostResolver read-only
private
TenantHostResolver|null
$tenantHostResolver
= null
Methods
__construct()
Constructor.
public
__construct(bool $enabled, TenantConnectionManager $connectionManager[, string $requiredSchemaVersion = '' ][, PlatformHealthCheckerInterface|null $platformHealth = null ][, TenantHostResolver|null $tenantHostResolver = null ][, TenantOperationalMetricsService|null $operationalMetrics = null ]) : mixed
Parameters
- $enabled : bool
-
Whether tenant resolution should run
- $connectionManager : TenantConnectionManager
-
Tenant connection manager
- $requiredSchemaVersion : string = ''
-
Minimum schema version required by this app revision
- $platformHealth : PlatformHealthCheckerInterface|null = null
-
Platform health checker
- $tenantHostResolver : TenantHostResolver|null = null
- $operationalMetrics : TenantOperationalMetricsService|null = null
process()
Resolve the request host to a tenant and bind tenant context for the request.
public
process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
Parameters
- $request : ServerRequestInterface
-
Request
- $handler : RequestHandlerInterface
-
Handler
Return values
ResponseInterfacehandlePlatformAdminHost()
Allow the dedicated platform-admin host to bypass tenant DB binding.
private
handlePlatformAdminHost(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
Parameters
- $request : ServerRequestInterface
- $handler : RequestHandlerInterface
Return values
ResponseInterfaceisPlatformAdminHost()
Check whether a request host is reserved for the platform-admin portal.
private
isPlatformAdminHost(string $host) : bool
Parameters
- $host : string
Return values
boolrecordOperationalMetric()
Record a privacy-safe request aggregate without affecting the response.
private
recordOperationalMetric(string $tenantId, ServerRequestInterface $request, int $statusCode, int $startedAt) : void
Parameters
- $tenantId : string
- $request : ServerRequestInterface
- $statusCode : int
- $startedAt : int
routeName()
Build a route identifier without IDs, query strings, or request data.
private
routeName(ServerRequestInterface $request) : string
Parameters
- $request : ServerRequestInterface