razxc/dotenv

Parser for env-files with bash syntax compatibility and zero-dependencies

Installs: 9

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/razxc/dotenv

0.1.0 2022-08-05 08:37 UTC

This package is auto-updated.

Last update: 2025-10-05 15:42:25 UTC


README

Latest Stable Version Total Downloads License PHP Version Require codecov

The PHP library provides pure dot-env parser with bash syntax support and zero-dependencies. Required PHP 7.3 or higher.

Alternatives: symfony/dotenv, vlucas/phpdotenv

Feature

  • "export" notation
  • default values
  • multiline values
  • variable resolving

Installation

composer require razxc/dotenv

Example

$array = DotenvParser::fromFile('path/to/.env', $_ENV);

foreach ($array as $name => $value) {
    putenv("$name=$value");
}

foreach ($array as $name => $value) {
    print $name . ' => ' . getenv($name) . PHP_EOL;
}

TODO

  • command resolving