Raydium Framework

Tenant
in package
implements TenantInterface

Interfaces, Classes, Traits and Enums

TenantInterface

Table of Contents

$appPath  : mixed
__construct()  : mixed
envTenantId()  : string|null
getCurrentPath()  : string
getHttpEnv()  : null|string
Get the current set wp app env.
getTenantFilePath()  : null|string
Retrieves the path for a tenant-specific file, with an option to enforce strict finding.
isLandlord()  : bool
Checks if the provided tenant ID matches the landlord's UUID.
isMultitenantApp()  : bool
Determines if the application is configured to operate in multi-tenant mode.
determineEnvPath()  : string
Determines the env file application path, accounting for multi-tenancy.

Properties

$appPath

protected mixed $appPath

Methods

__construct()

public __construct(string $appPath) : mixed
Parameters
$appPath : string
Return values
mixed

envTenantId()

public static envTenantId() : string|null
Return values
string|null

getCurrentPath()

public getCurrentPath() : string
Return values
string

getHttpEnv()

Get the current set wp app env.

public getHttpEnv() : null|string

This is used in the compose mu plugin.

Return values
null|string

the current app env set, or null if not defined

getTenantFilePath()

Retrieves the path for a tenant-specific file, with an option to enforce strict finding.

public getTenantFilePath(string $dir[, bool $find_or_fail = false ]) : null|string

In a multi-tenant application, this function attempts to find a file specific to the current tenant. If the file is not found and 'find_or_fail' is set to true, the function will return null. If the tenant-specific file does not exist (and 'find_or_fail' is false), it falls back to a default file path. If neither file is found, or the application is not in multi-tenant mode, null is returned.

Parameters
$dir : string

The directory within the app path where the file should be located.

$find_or_fail : bool = false

Whether to fail if the tenant-specific file is not found.

Return values
null|string

The path to the file if found, or null otherwise.

isLandlord()

Checks if the provided tenant ID matches the landlord's UUID.

public isLandlord([null|string $tenant_id = null ]) : bool

This function determines if a given tenant ID is equivalent to the predefined LANDLORD_UUID constant, identifying if the tenant is the landlord.

Parameters
$tenant_id : null|string = null

The tenant ID to check against the landlord's UUID. Default is null.

Return values
bool

True if the tenant ID matches the landlord's UUID, false otherwise.

isMultitenantApp()

Determines if the application is configured to operate in multi-tenant mode.

public isMultitenantApp() : bool

This is based on the presence and value of the ALLOW_MULTITENANT constant. If ALLOW_MULTITENANT is defined and set to true, the application is considered to be in multi-tenant mode.

Return values
bool

Returns true if the application is in multi-tenant mode, otherwise false.

determineEnvPath()

Determines the env file application path, accounting for multi-tenancy.

private determineEnvPath(string $base_path) : string
Parameters
$base_path : string

The base application directory path.

Return values
string

The determined application path.

Search results