Install package via composer:
composer require m4rku5/dotenv
From .env
...
# DOCKER:
DOCKER_PORT=8001
# PROJECT:
#PROJECT_DOCUMENTROOT=public
#PROJECT_LOGS=logs
... doing ...
$dotenv = new Dotenv('.env');
$dotenv->set('PROJECT_DOCUMENTROOT', 'test');
$dotenv->enable('PROJECT_DOCUMENTROOT');
$dotenv->set('HELLO', 'World');
$dotenv->disable('HELLO');
$dotenv->unset('DOCKER_PORT');
$dotenv->save();
... will result in ...
# DOCKER:
# PROJECT:
PROJECT_DOCUMENTROOT=test
#PROJECT_LOGS=logs
#HELLO=World
Please see CHANGELOG for more information on what has changed recently.
The MIT License (MIT). Please see License File for more information.