nichin79/dotenv

There is no license information available for the latest version (v1.0.0) of this package.

Read and use .env files

v1.0.0 2023-06-06 22:00 UTC

This package is auto-updated.

Last update: 2024-09-07 01:28:09 UTC


README

Example

require_once __DIR__ . '/../vendor/autoload.php';

(new Nichin79\DotEnv\DotEnv(__DIR__ . '/../.env'))->load();
$config = [
  'dsn' => $_ENV['DB_DSN'],
  'user' => $_ENV['DB_USER'],
  'pass' => $_ENV['DB_PASS'],
];

var_dump($config);
var_dump($_ENV);
var_dump($_SERVER);