AppFactory
in package
Table of Contents
- $app : mixed
- $request : mixed
- create() : App
- Initializes and returns an instance of App.
- run() : void
- defineMandatoryConstants() : void
- loadDotEnv() : void
- copySourceConfigFile() : void
- createRequest() : mixed
- setEnvironment() : void
- Set the environment type for the application.
- setErrorHandler() : void
Properties
$app
private
static mixed
$app
$request
private
static mixed
$request
Methods
create()
Initializes and returns an instance of App.
public
static create(string $appDirPath[, null|string $environment = null ][, ServerRequestInterface|null $request = null ]) : App
Parameters
- $appDirPath : string
-
The directory path for the application.
- $environment : null|string = null
-
The environment setting, e.g., 'development', 'production'.
- $request : ServerRequestInterface|null = null
Return values
App —An initialized App instance.
run()
public
static run() : void
Return values
void —defineMandatoryConstants()
protected
static defineMandatoryConstants(string $appDirPath, string $httpHost) : void
Parameters
- $appDirPath : string
- $httpHost : string
Return values
void —loadDotEnv()
protected
static loadDotEnv(array<string|int, mixed> $envFiles, EnvType $envType) : void
Parameters
- $envFiles : array<string|int, mixed>
- $envType : EnvType
Return values
void —copySourceConfigFile()
private
static copySourceConfigFile(Container $psrContainer) : void
Parameters
- $psrContainer : Container
Return values
void —createRequest()
private
static createRequest([ServerRequestInterface|null $request = null ]) : mixed
Parameters
- $request : ServerRequestInterface|null = null
Return values
mixed —setEnvironment()
Set the environment type for the application.
private
static setEnvironment([null|string $environment = null ]) : void
This function sets the environment type by defining the RAYDIUM_ENVIRONMENT_TYPE
constant.
If the environment type is not provided, it defaults to null
and can fallback to .env
file setup.
Usage:
- If
$environment
is provided, it will define theRAYDIUM_ENVIRONMENT_TYPE
. - If
$environment
isnull
, the function will allow the.env
file to define the environment type.
Parameters
- $environment : null|string = null
-
The environment type, which can be a string (e.g., 'production', 'development') or null to use the .env file setup.
Return values
void —setErrorHandler()
private
static setErrorHandler() : void