A Laravel package for editing the .env file dynamically.
Clone or download
Brotzka Merge pull request #53 from elegasoft/master
Resolves blank line in env error #42
Latest commit 0ae9ecf Jul 2, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
images Renaming Images Jul 31, 2016
src Merge pull request #53 from elegasoft/master Jul 2, 2018
.gitattributes Update .gitattributes Nov 24, 2016
.gitignore Renaming Images Jul 31, 2016
README.md Add Codacy badge Jan 4, 2018
composer.json Update composer.json Feb 13, 2018


Codacy Badge Latest Stable Version Total Downloads Latest Unstable Version License

Edit your Laravel .env file

This package offers you the possibility to edit your .env dynamically through a controller or model.

The current version (2.x) ships with a graphical user interface based on VueJS to offer you a very simple implementation of all features.

List of available functions:

  • check, if a given key exists
  • get the value of a key
  • get the complete content of your .env
  • get the content as JSON
  • change existing values
  • add new key-value-pairs
  • delete existing key-value-pairs
  • create/restore/delete backups
  • list all backups
  • get the content of a backup
  • enable auto-backups
  • check, if auto-backups are enabled or not
  • get and set a backup-path

Here are some images showing the gui which ships with the current version:

Overview Overview with loaded content Edit an entry Adding a new key-value-pair Backups Showing the content of a backup More options for backups Uploading Backups


Visit the Wiki-page to get more Information.


The following example shows an controller with a method, in which we change some values from the .env. Make sure, the entries you want to change, really exist in your .env.

namespace App\Http\Controllers;

use Brotzka\DotenvEditor\DotenvEditor;

class EnvController extends Controller
    public function test(){
        $env = new DotenvEditor();

            'TEST_ENTRY1'   => 'one_new_value',
            'TEST_ENTRY2'   => $anotherValue,

For more exmaples visit the Wiki.