PHP code example of tina4stack / tina4php-env

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

    

tina4stack / tina4php-env example snippets


use Tina4\Env;

// Loads .env from the project root
new Env();

// Access variables as constants or via $_ENV
echo DB_HOST;          // "localhost"
echo $_ENV["DB_NAME"]; // "myapp"

// If ENVIRONMENT=staging, loads .env.staging
new Env();

// Or force a specific environment
new Env("production"); // loads .env.production