Class Dotenv\Dotenv

InheritanceDotenv\Dotenv

This is the dotenv class.

It's responsible for loading a .env file in the given directory and setting the environment vars.

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$filePath string Dotenv\Dotenv
$loader Dotenv\Loader|null Dotenv\Dotenv

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Create a new dotenv instance. Dotenv\Dotenv
load() Load environment file in given directory. Dotenv\Dotenv
overload() Load environment file in given directory. Dotenv\Dotenv
required() Required ensures that the specified variables exist, and returns a new validator object. Dotenv\Dotenv

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
getFilePath() Returns the full path to the file. Dotenv\Dotenv
loadData() Actually load the data. Dotenv\Dotenv

Property Details

$filePath protected property
protected string $filePath null
$loader protected property
protected Dotenv\Loader|null $loader null

Method Details

__construct() public method

Create a new dotenv instance.

public void __construct ( $path, $file '.env' )
$path string
$file string
getFilePath() protected method

Returns the full path to the file.

protected string getFilePath ( $path, $file )
$path string
$file string
load() public method

Load environment file in given directory.

public array load ( )
loadData() protected method

Actually load the data.

protected array loadData ( $overload false )
$overload bool
overload() public method

Load environment file in given directory.

public array overload ( )
required() public method

Required ensures that the specified variables exist, and returns a new validator object.

public Dotenv\Validator required ( $variable )
$variable string|string[]