Application
in package
Main application class that bootstraps and runs LWT.
Tags
Table of Contents
Properties
- $basePath : string
- Base path for the application.
- $container : Container
- The dependency injection container.
- $providers : array<string|int, ServiceProviderInterface>
- Service providers to register.
Methods
- __construct() : mixed
- Create a new Application instance.
- bootstrap() : void
- Bootstrap the application.
- getContainer() : Container
- Get the DI container instance.
- run() : void
- Run the application.
- getWizardFormData() : array<string, string>
- Get database wizard form data from request parameters.
- handleMissingEnv() : void
- Handle missing .env file.
- hasEnvFile() : bool
- Check if configuration is available (either .env file or environment variables).
- isDebugMode() : bool
- Check if the application is running in debug mode.
- registerAutoloader() : void
- Register the PSR-4 autoloader for Lwt namespace.
- registerExceptionHandler() : void
- Register the global exception handler.
- registerServiceProviders() : void
- Register all service providers with the container.
- runDatabaseWizard() : void
- Run the database wizard without requiring database connection.
- showNoEnvErrorPage() : void
- Display error page when .env is missing.
Properties
$basePath
Base path for the application.
private
string
$basePath
$container
The dependency injection container.
private
Container
$container
$providers
Service providers to register.
private
array<string|int, ServiceProviderInterface>
$providers
= []
Methods
__construct()
Create a new Application instance.
public
__construct(string $basePath) : mixed
Parameters
- $basePath : string
-
The base path of the application
bootstrap()
Bootstrap the application.
public
bootstrap() : void
Sets up error reporting, include paths, autoloading, and DI container.
getContainer()
Get the DI container instance.
public
getContainer() : Container
Tags
Return values
Containerrun()
Run the application.
public
run() : void
Handles the incoming request through the router.
Tags
getWizardFormData()
Get database wizard form data from request parameters.
private
getWizardFormData() : array<string, string>
Return values
array<string, string> —Form data array
handleMissingEnv()
Handle missing .env file.
private
handleMissingEnv() : void
Shows the database wizard if requested, otherwise shows an error page.
hasEnvFile()
Check if configuration is available (either .env file or environment variables).
private
hasEnvFile() : bool
For Docker deployments, configuration may come from environment variables instead of a .env file. We check for DB_HOST as the minimum required variable.
Return values
boolisDebugMode()
Check if the application is running in debug mode.
private
isDebugMode() : bool
Debug mode is enabled when:
- APP_DEBUG environment variable is set to 'true' or '1'
- Or APP_ENV is 'development' or 'local'
Return values
boolregisterAutoloader()
Register the PSR-4 autoloader for Lwt namespace.
private
registerAutoloader() : void
registerExceptionHandler()
Register the global exception handler.
private
registerExceptionHandler(bool $debug) : void
Parameters
- $debug : bool
-
Whether to show detailed error information
registerServiceProviders()
Register all service providers with the container.
private
registerServiceProviders() : void
runDatabaseWizard()
Run the database wizard without requiring database connection.
private
runDatabaseWizard() : void
Uses the Admin module's wizard use cases which work without database.
Tags
showNoEnvErrorPage()
Display error page when .env is missing.
private
showNoEnvErrorPage() : void