absolutehh/dotenv-manipulator

This package can manipulate the .env file of a laravel project on runtime.

This package's canonical repository appears to be gone and the package has been frozen as a result.

1.2 2017-05-19 13:41 UTC

This package is not auto-updated.

Last update: 2021-01-19 08:10:46 UTC


README

This package can manipulate the .env file on runtime.

GitHub release GitHub license GitHub issues

StyleCI Code Climate

Installation

Add it as dependency to composer composer require absolutehh/dotenv-manipulator and add the \Absolute\DotEnvManipulator\ManipulatorServiceProvider to your config/app.php

Usage

Code

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();

Command-Line

php artisan dotenv:get YOUR_ENV_VAR
php artisan dotenv:set YOUR_ENV_VAR --value=new_value