Code Monkey home page Code Monkey logo

laravel-enveditor's Introduction

Coverage Status Codacy Badge Maintainability License

Laravel .env Editor (plus GUI)

This Package allows to manage Laravel .env file values on the Fly (add, edit, delete keys), upload another .env or create backups
Management can be done through the user interface, or programmatically by using the EnvEditor Facade, without breaking the files structure.
The inspiration for this package was, Brotzka/laravel-dotenv-editor.

  1. Install package

    composer require geo-sot/laravel-env-editor
  2. Publish assets

    php artisan vendor:publish --provider=GeoSot\EnvEditor\ServiceProvider     

    This will publish all files:

    • config -> env-editor.php
    • views -> resources/views/vendor/env-editor/..
    • lang -> resources/lang/vendor/env-editor.php

    Or publish specific tags

     //Publish specific tag
     php artisan vendor:publish --tag=config
     php artisan vendor:publish --tag=translations
     php artisan vendor:publish --tag=views
     
     //Publish specific Tag from this Vendor
     php artisan vendor:publish --provider=GeoSot\EnvEditor\ServiceProvider --tag=config  
    
  • getEnvFileContent
  • keyExists
  • getKey
  • addKey
  • editKey
  • deleteKey
  • getAllBackUps
  • upload
  • backUpCurrent
  • getFilePath
  • deleteBackup
  • restoreBackUp
Example
  
 EnvEditor::getEnvFileContent($fileName='') 
 // Return The .env Data as Collection.
 // If FileName Is provided it searches inside backups Directory and returns these results

 EnvEditor::keyExists($key)
 // Search key existance in .env
 
 EnvEditor::getKey(string $key, $default = null)    
 // Get key value from .env,

  EnvEditor::addKey($key, $value, array $options = [])
  // Adds new Key in .env file
  // As options can pass ['index'=>'someNumericIndex'] in order to place the new key after an other and not in the end,
  // or ['group'=>'MAIL/APP etc'] to place the new key oat the end of the group 

  EnvEditor::editKey($key, $value)
  // Edits existing key value

  EnvEditor::deleteKey($key)    

  EnvEditor::getAllBackUps()
  // Returns all Backup files as collection with some info like, created_date, content etc.

  EnvEditor::upload(UploadedFile $uploadedFile, $replaceCurrentEnv)
  // Gets an UploadedFile and stores it as backup or as current .env

  EnvEditor::backUpCurrent()
  // Backups current .env

  EnvEditor::getFilePath($fileName = '')
  // Returns the full path of a backup file. 
  // If $fileName is empty returns the full path of the .env file

  EnvEditor::deleteBackup($fileName)
  

  EnvEditor::restoreBackUp()
  

User Interface Contains three Tabs


Overview

AddKey

EditKey

DeleteKey

Overview

Overview

Upload

Overview

laravel-enveditor's People

Contributors

arnoldnicole avatar geo-sot avatar geosot avatar itcyborg avatar nguyentranchung avatar rikj000 avatar stylecibot avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.