PHP code example of brunoviana / dotenv-manipulator
1. Go to this page and download the library: Download brunoviana/dotenv-manipulator 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/ */
brunoviana / dotenv-manipulator example snippets
use Absolute\DotEnvManipulator\Libs\DotEnv;
$dotenv = new DotEnv('/ma/app/base/path', '.env');
// get current value
$value = $dotenv->get('YOUR_ENV_VAR');
// set and write value
$dotenv->set('YOUR_ENV_VAR', 'new_value')->write();
// sort variables in .env file
$dotenv->sort()->write();
bash
php artisan dotenv:get YOUR_ENV_VAR
php artisan dotenv:set YOUR_ENV_VAR --value=new_value