PHP code example of innoboxrr / laravel-env-editor

1. Go to this page and download the library: Download innoboxrr/laravel-env-editor library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

innoboxrr / laravel-env-editor example snippets


     
    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()
     


 
bash
     php artisan vendor:publish --provider=Innoboxrr\EnvEditor\ServiceProvider     
      
bash
     //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=Innoboxrr\EnvEditor\ServiceProvider --tag=config