brunoviana/dotenv-manipulator

A mirror of absolutehh/dotenv-manipulator | This package can manipulate the .env file of a laravel project on runtime.

1.0.0 2021-01-25 21:13 UTC

This package is auto-updated.

Last update: 2024-04-26 04:15:14 UTC


README

This is a mirror of absolutehh/dotenv-manipulator that was deleted. All the credits to the authors mentioned in composer.json.

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