PHP code example of cronfy / env

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

    

cronfy / env example snippets


// any environment loader can be used, we just need $environment to be an array
$environment = (new josegonzalez\Dotenv\Loader(__DIR__ . '/.env'))
    ->parse()
    ->toArray();

// load envirinment data
Env::load($environment);

// use environment variables
echo Env::get('MYSQL_USER');

// set variables
Env::set('MYSQL_USER', 'value');