PHP code example of rb-cohen / php-env

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

    

rb-cohen / php-env example snippets


$config = [
  'mysql' => [
    'host' => env('DB_HOST', 'localhost'),
    'username' => env('DB_USERNAME', 'dbuser'),
    'password' => env('DB_PASSWORD'),
    'dbname' => env('DB_NAME', 'my_database'),
  ]
];

$username = env('USER', function(){
  return exec('whoami');
});