Documentation

FileSystemEnvRepository

FileSystem repository for .env file operations.

Provides file system access for database connection wizard. This class operates independently of the database.

Tags
since
3.0.0

Table of Contents

Properties

$envPath  : string
Path to the .env file.

Methods

__construct()  : mixed
Constructor.
exists()  : bool
Check if .env file exists.
getAutocompleteSuggestions()  : DatabaseConnectionDTO
Get autocomplete values from server environment.
getPath()  : string
Get .env file path.
load()  : DatabaseConnectionDTO
Load connection from .env file.
save()  : bool
Save connection to .env file.
testConnection()  : array{success: bool, error: ?string}
Test a database connection.
quoteEnvValue()  : string
Quote an env value for safe storage.
unquoteEnvValue()  : string
Unquote an env value when loading.

Properties

Methods

__construct()

Constructor.

public __construct([string|null $basePath = null ]) : mixed
Parameters
$basePath : string|null = null

Base path for .env file (default: LWT root)

exists()

Check if .env file exists.

public exists() : bool
Return values
bool

True if file exists

quoteEnvValue()

Quote an env value for safe storage.

private quoteEnvValue(string $value) : string

Always uses double quotes and escapes special characters.

Parameters
$value : string

Raw value

Return values
string

Quoted and escaped value

unquoteEnvValue()

Unquote an env value when loading.

private unquoteEnvValue(string $value) : string

Handles both single and double quoted values, and unescapes characters.

Parameters
$value : string

Quoted value from .env file

Return values
string

Unquoted and unescaped value


        
On this page

Search results