Documentation

Application
in package

Main application class that bootstraps and runs LWT.

Tags
category

Core

author

LWT Project lwt-project@hotmail.com

license

Unlicense http://unlicense.org/

link
https://hugofara.github.io/lwt/docs/php/files/src-backend-Application.html
since
3.0.0

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

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
psalm-suppress

PossiblyUnusedMethod

Return values
Container

run()

Run the application.

public run() : void

Handles the incoming request through the router.

Tags
psalm-suppress

UndefinedFunction Function loaded via require_once

psalm-suppress

UnresolvableInclude Path computed from basePath

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
bool

isDebugMode()

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
bool

registerAutoloader()

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
psalm-suppress

UnusedVariable Variables used by included wizard.php view

psalm-suppress

UnresolvableInclude Path computed from basePath

showNoEnvErrorPage()

Display error page when .env is missing.

private showNoEnvErrorPage() : void

        
On this page

Search results