PHP code example of datahihi1 / tiny-env

1. Go to this page and download the library: Download datahihi1/tiny-env library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

datahihi1 / tiny-env example snippets



use Datahihi1\TinyEnv\TinyEnv;
$env = new TinyEnv(__DIR__);
$env->load();

$env->load(convertToConst: true);

use function Datahihi1\TinyEnv\env;
$env = env('NAME');
print_r($env); // Result: TinyEnv

use function Datahihi1\TinyEnv\env;
$env = env('TESTER','Datahihi1');
print_r($env); // Result: Datahihi1

print_r(env());

use function Datahihi1\TinyEnv\setenv;
setenv('KEY','demo'); // will set or update environment variable in .env file