Skip to content
This repository was archived by the owner on Aug 27, 2024. It is now read-only.

CommandString/Env

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

commandstring/env

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";

About

A singleton class used for storing environment variables

Topics

Resources

License

Stars

Watchers

Forks

Languages