This package is abandoned and no longer maintained. No replacement package was suggested.

v1.0.1 2023-02-15 15:56 UTC

This package is auto-updated.

Last update: 2024-09-15 20:00:17 UTC


README

A singleton class used for storing environment variables

Requirements

  • PHP 8.1
  • Composer

Creating with JSON file

/env.json

{
    "mysql": {
        "username": "root",
        "password": "password",
        "host": "127.0.0.1",
        "port": 3306
    }
}

/index.php

Env::createWithJsonFile(__DIR__."/env.json");

Creating with an array

Env::createFromArray(["hello" => "world"]);

Note that nested arrays will be converted into an stdClass

Getting / Setting variables

Env::get("property");
Env::get()->property;

Env::get()->property = "value";