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
Requires
- php: >=5.6.0
Requires (Dev)
- illuminate/console: ~5.0
- illuminate/support: ~5.0
- laravel/framework: ~5.0
- laravel/lumen: ~5.0
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.
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