Laravel Env Manager

Laravel Env Manager

Latest Stable Version Total Downloads License
View Package

Laravel Env Manager
Overview: Laravel Env Manager simplifies the management of Laravel environment variables. With both command line and web interface options, developers can efficiently configure and maintain their .env settings.

Installation: 

Install the package via Composer:

composer require dipesh79/laravel-env-manager

Publish the vendor file for configuration:

php artisan vendor:publish --provider="Dipesh79\LaravelEnvManager\LaravelEnvManagerServiceProvider"

Usage: 

CLI

Manage your environment variables using the command line interface:

php artisan env:list // List all env variables with values
php artisan env:remove {key} // Remove the env key
php artisan env:set {key} {value} // Add Key to env
php artisan env:backup // Backup your current .env file
php artisan env:restore {timestamp}// Restore your backup .env file

WEB

Manage your environment variables using web interface.

Setup: 

Implement LaravelEnvEditorInterface on User Model and add hasAccessToPage() function on User model as shown below

<?php
use Dipesh79\LaravelEnvManager\Contracts\LaravelEnvEditorInterface;

class User extends Authenticatable implements LaravelEnvEditorInterface
{   
   ...
   public function hasAccessToPage(): bool
   {
       return true; // Add your condition here which user will be able to see the web interface.
   }    
}

Now, Check this url on your browser

https://domain.com/env

You can add, edit and delete the key value from .env file.


NOTE: You have to submit the form in order to change the .env file. If you remove using remove icon or add new variable or edit the key value, you have to submit the form in order to update the .env file. 


License: MIT

Author: @Dipesh79

Support: For support, email dipeshkhanal79[at]gmail[dot]com.

This post is licensed under CC BY 4.0 by the author.