PHP code example of zhangdi / yii2-env

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

    

zhangdi / yii2-env example snippets



use ZhangDi\Env\Env;

// get raw value
$rawValue = Env::get('ENV_NAME', 'default value');

// get bool value, second argument is default value
$boolValue = Env::getBoolean('ENV_NAME', false);

// get int value, second argument is default value
$intValue = Env::getInt('ENV_NAME', 0);