Skip to content
Fabian Hagen edited this page Oct 1, 2016 · 6 revisions

In this section:

  • Update
  • Installation
    • Composer require
    • Manually
    • After installation
  • Config
  • Views
  • Additional middleware

Update

If you had already installed version 1.x, you have to reinstall the package vie the require command. So the old version will be replaced with the new one.

Installation

Via composer require

Install the package via the composer require command:

composer require brotzka/laravel-dotenv-editor

In order to always get the latest version of 2.*, you should change the update conditions in your composer.json require section. Change this

"brotzka/laravel-dotenv-editor": "^2.0"

to this

"brotzka/laravel-dotenv-editor": "2.*"

Add the package manually

Add the following line to your composer.json require section:

"require": {
    //other packages
    "brotzka/laravel-dotenv-editor": "2.*"
}

Then run the composer update command:

composer update

After Installation

Add the following line to your config/app.php providers:

Brotzka\DotenvEditor\DotenvEditorServiceProvider::class,

Add the following line to your config/app.php aliases:

'DotenvEditor' => Brotzka\DotenvEditor\DotenvEditorFacade::class,

Finally you have to publish the config file and view via:

php artisan vendor:publish --provider="Brotzka\DotenvEditor\DotenvEditorServiceProvider"

After an Update, maybe you have to force publish:

php artisan vendor:publish --provider="Brotzka\DotenvEditor\DotenvEditorServiceProvider" --force

Be careful, this will overwrite all your published files! It's always better to delete the config/dotenveditor.phpfile manually and then run the php artisan vendor:publish command than to run the force version.

Now you can edit the config file and put in your values.

Config

Open the config/dotenveditor.php and fill it up with your values.

Note: I had an issue where I had to switch the web-middleware between middleware and middlewareGroups. In Laravel 5.2, put the web-middleware in the middleware array. For Laravel 5.1 put it in the middlewareGroups array.

The path to your .env should not be changed.

Deactivate GUI

If you don't want to use the graphical interface, you could deactivate it in the config.

Additional middleware

If you want to add more middlewares to the used routes, you could put them in the arrays.