Skip to content

Version 1.0.1

Choose a tag to compare

@naingaunglwin-dev naingaunglwin-dev released this 25 Mar 16:46
· 12 commits to master since this release

Added

  • Load
    • Dotenv no longer autoload the .env file on creating a new instance by default.
    • To load the .env file on creating new instance, you now need to pass the second argument as true when instantiating the class.
    • You can now manually load the .env file by calling the load() method.
    • load() method return Dotenv class.
    • Add new method getInGroup(string $group),
// Create new instance with autoload
$dotenv = new \NAL\Dotenv\Dotenv('path/to/your/file/.env', true);

// Load manually
$dotenv = new \NAL\Dotenv\Dotenv('path/to/your/file/.env');

$dotenv->load();


// if you set your environment variables in group like this,
APP_URL='https://example.com/'
APP_KEY=1234567

// You can use `getInGroup` method to retrieve all of that same group variables,
$dotenv->getInGroup('APP');

// Output
array(2) {
    [0] =>
    string(7) "APP_URL"
    [1] =>
    string(7) "APP_KEY"
}
  • Remove deleted variables
    • This includes removing deleted environment variables from $_SERVER, $_ENV, and getenv().