safeLoad

Load while ignoring missing env files

PHP

$dotenv->safeLoad()

Usage

Equivalent to load(ignore: ['MISSING_ENV_FILE']). Returns injected values and still reports other diagnostics or throws for fatal errors. It takes no arguments.


<?php
$values = Dotenvx\Dotenvx::createImmutable(__DIR__)->safeLoad();

markdown