Tenancy
in package
Table of Contents
- $appPath : mixed
- $configsDir : mixed
- $constant : mixed
- $envType : mixed
- $tenant : mixed
- __construct() : mixed
- Tenancy constructor.
- init() : Dotenv
- Initializes the App Kernel with optional multi-tenant support.
- setupMultiTenant() : void
- Sets up the environment for a multi-tenant configuration.
- defineTenantConstants() : void
- Defines constants based on the tenant's information.
- getDBPrefix() : null|string
- Determines the database prefix for the tenant.
- maybeRegenerateEnvFile() : void
- Regenerates the tenant-specific .env file if it doesn't exist.
Properties
$appPath
private
mixed
$appPath
$configsDir
private
mixed
$configsDir
$constant
private
mixed
$constant
$envType
private
mixed
$envType
$tenant
private
mixed
$tenant
Methods
__construct()
Tenancy constructor.
public
__construct(string $appPath, string $siteConfigDir) : mixed
Parameters
- $appPath : string
-
The base directory path of the application (e.g., DIR).
- $siteConfigDir : string
-
The site config directory name
Return values
mixed —init()
Initializes the App Kernel with optional multi-tenant support.
public
init(Dotenv $_dotenv) : Dotenv
Parameters
- $_dotenv : Dotenv
Tags
Return values
Dotenv —setupMultiTenant()
Sets up the environment for a multi-tenant configuration.
protected
setupMultiTenant(Dotenv $_dotenv) : void
Parameters
- $_dotenv : Dotenv
Return values
void —defineTenantConstants()
Defines constants based on the tenant's information.
private
defineTenantConstants() : void
Return values
void —getDBPrefix()
Determines the database prefix for the tenant.
private
getDBPrefix(string $tenantId) : null|string
Parameters
- $tenantId : string
-
Tenant's UUID.
Return values
null|string —Database prefix or null if not the main site.
maybeRegenerateEnvFile()
Regenerates the tenant-specific .env file if it doesn't exist.
private
maybeRegenerateEnvFile(string $tenantId) : void
Parameters
- $tenantId : string
-
Tenant's UUID.