1. Go to this page and download the library: Download redot/dotenv-editor 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/ */
redot / dotenv-editor example snippets
use Redot\DotenvEditor\DotenvEditor;
$editor = new DotenvEditor('/path/to/.env');
$editor = new DotenvEditor('/path/to/.env', true);
$value = $editor->get('KEY');
$value = $editor->get('KEY', 'default');
$editor->set('KEY', 'value');
$editor->save();
$editor = new DotenvEditor('/path/to/.env', true);
use Redot\DotenvEditor\DotenvEditor;
use Redot\DotenvEditor\Exceptions\FileNotFoundException;
try {
$editor = new DotenvEditor('/path/to/.env');
$editor->set('APP_ENV', 'production');
$editor->set('APP_DEBUG', 'false');
$editor->save();
echo 'Changes saved successfully.';
} catch (FileNotFoundException $e) {
echo 'The file could not be found.';
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.