LoadEnvironmentVariables
in package
Class LoadEnvironmentVariables
Tags
Table of Contents
Methods
- checkEnvironmentFileExists() : bool
- Checks if the environment file exists and is readable.
- load() : void
- Loads the environment variables from the specified path.
- setEnvironmentPath() : string
- Sets the environment path by trimming the path and adding the '.env' extension if needed.
Methods
checkEnvironmentFileExists()
Checks if the environment file exists and is readable.
protected
static checkEnvironmentFileExists(string $path) : bool
Parameters
- $path : string
-
The path to the environment file.
Return values
bool —True if the file exists and is readable, false otherwise.
load()
Loads the environment variables from the specified path.
protected
static load(string $path) : void
Parameters
- $path : string
-
The path to the environment file.
setEnvironmentPath()
Sets the environment path by trimming the path and adding the '.env' extension if needed.
protected
static setEnvironmentPath(string|null $path, string $appPath) : string
Parameters
- $path : string|null
-
The path to be set. If empty, the default path will be used.
- $appPath : string
-
The path to the application.
Return values
string —The set environment path.