PHP code example of codezero / dotenv-updater

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

    

codezero / dotenv-updater example snippets


$updater = new \CodeZero\DotEnvUpdater\DotEnvUpdater('/path/to/.env');

$updater->set('MY_ENV_KEY', 'Some Value'); // Strings
$updater->set('MY_ENV_KEY', 25); // Integers
$updater->set('MY_ENV_KEY', true); // Booleans
$updater->set('MY_ENV_KEY', null); // NULL values
$updater->set('MY_ENV_KEY', ''); // Empty values

$value = $updater->get('MY_ENV_KEY');