PHP code example of tnapf / env

1. Go to this page and download the library: Download tnapf/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/ */

    

tnapf / env example snippets


use Tnapf\Env\Env;

$env = new Env();

$env->devMode = true;

// or

$env['devMode'] = true;

####################################
#   Somewhere else in the script   #
####################################

Env::get()->devMode; // true

// or

Env::get()['devMode']; // true

use Tnapf\Env\Env;

$env = Env::createFromFile(__DIR__ . '/.env');

use Tnapf\Env\Env;

$env = Env::createFromString('devMode=true');

use Tnapf\Env\Env as TnapfEnv;

/**
 * @property bool $devMode
 * @property string $databaseHost
 * @property string $databaseUser
 * @property string $databasePassword
 * @property string $databaseName
 */
class Env extends TnapfEnv
{
}