This package provides some basic tools for editing dotenv files.
You can install the package via composer:
composer require tal7aouy/dotenv
Given we have an existing file at base_path('.env')
.
We can add a new section to the existing configuration file.
$dotenv = new Dotenv();
$dotenv->load(base_path('.env'));
$dotenv->heading('DB_CONNECTION');
$dotenv->set('DB_CONNECTION', 'mysql');
$dotenv->set('DB_HOST', '127.0.0.1');
$dotenv->set('DB_PORT', '3306');
$dotenv->set('DB_DATABASE', 'demo');
$dotenv->set('DB_USERNAME', 'root');
$dotenv->set('DB_PASSWORD', '');
$dotenv->getEnv('DB_DATABASE'); // demo
$dotenv->save();
This will result in the following changes.
APP_KEY=supersecret
# DB_CONNECTION
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=demo
DB_USERNAME=root
DB_PASSWORD=
> composer test
StyleCI will apply the Laravel preset.
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email oss@tjmiller.co instead of using the issue tracker.
Please see License File for more information.