LoadConnection
in package
Use case for loading database connection from .env file.
This use case does NOT require database access.
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- Constructor.
- envExists() : bool
- Check if .env file exists.
- execute() : DatabaseConnectionDTO
- Execute the use case.
- getEnvPath() : string
- Get path to .env file.
Properties
$repository
private
FileSystemEnvRepository
$repository
Methods
__construct()
Constructor.
public
__construct([FileSystemEnvRepository|null $repository = null ]) : mixed
Parameters
- $repository : FileSystemEnvRepository|null = null
-
Env file repository
envExists()
Check if .env file exists.
public
envExists() : bool
Return values
bool —True if file exists
execute()
Execute the use case.
public
execute() : DatabaseConnectionDTO
Return values
DatabaseConnectionDTO —Connection data
getEnvPath()
Get path to .env file.
public
getEnvPath() : string
Return values
string —Path to .env file