Download the PHP package mifesta/dotenv-editor without Composer

On this page you can find all versions of the php package mifesta/dotenv-editor. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package dotenv-editor

Laravel Dotenv Editor

laravel-dotenv-editor

Latest Stable Version Total Downloads Latest Unstable Version License

Laravel Dotenv Editor is an the .env file editor (or files with same structure and syntax) for Laravel 5+. Now you can easily edit .env files with following features:

Documentation

Look at one of the following topics to learn more about Laravel Dotenv Editor

Versions and compatibility

Currently, Laravel Dotenv Editor only have version 1.x that is compatible with Laravel 5+ and later. This package is not support for Laravel 4.2 and earlier versions.

Installation

You can install this package through Composer.

Note: Instead of performing the above two steps, you can perform faster with the command line $ composer require mifesta/dotenv-editor:1.*.

Configuration

To get started, you'll need to publish configuration file:

This will create a config/dotenv-editor.php file in your app that you can modify to set your configuration. Also, make sure you check for changes to the original config file in this package between releases.

Auto backup mode

The option autoBackup is determine that your orignal file will be backed up before save or not.

Backup location

The option backupPath is where that your file is backed up to. This value is the sub path (sub-folder) from root folder of project application.

Usage

Working with facade

Laravel Dotenv Editor has a facade with name is Mifesta\DotenvEditor\Facades\DotenvEditor. You can do any operation through this facade. For example:

Using dependency injection

This package also supports dependency injection, you can easily use dependency injection to inject an instance of the Mifesta\DotenvEditor\DotenvEditor class into your controller or other class. Example:

Loading file for working

Default, Laravel Dotenv Editor will load file .env in root folder of your project whenever you use the DotenvEditor facade. Example:

However, if you want to explicitly specify what files you will work with, you should use method load(). Example:

$file = DotenvEditor::load(); // Working with file .env in root folder
$file = DotenvEditor::load('.env.example'); // Working with file .env.example in root folder
$file = DotenvEditor::load(storage_path('dotenv-editor/backups/.env.backup')); // Working with file .env.backup in folder storage/dotenv-editor/backups/

Method load() have three parameters:

Reading file content

Reading raw content

You can use method getContent() to get raw content in your file. Example:

This will return raw file content as a string

Reading content by lines

Use method getLines() to get all lines in your file. Example:

This will return an array. Each element in array, you can see following info:

Reading content by keys

Use method getKeys($keys = []) to get all setter lines in your file. Example:

This will return an array. Each element in array, you can see following info:

Determine if key is exists

Use method keyExists($key). Example:

Get value of a key

Use method getValue($key). Example:

Writing content into file

To edit file content, you have two job:

Add an empty line into buffer

Use method addEmpty(). Example:

Add a comment line into buffer

Use method addComment($comment). Example:

Add or update a setter into buffer

Use method setKey($key, $value = null, $comment = null, $export = false). Example:

Add or update multi setter into buffer

Use method setKeys($data). Example:

Delete a setter line in buffer

Use method deleteKey($key). Example:

Delete multi setter lines in buffer

Use method deleteKeys($keys). Example:

Save buffer into file

Backing up and restoring file

Backup your file
Get all backup versions
Get latest backup version
Restore your file from latest backup or other file
Delete one backup file
Delete multi backup files
Change auto backup mode

Method chaining

Some functions of loading, writing, backing up, restoring are implementation and usage of method chaining. So these functions can be called to chained together in a single statement. Example:

Working with Artisan CLI

Now, Laravel Dotenv Editor have total 6 commands can use easily with Artisan CLI. Such as:

Please use each above command with option --help(-h) for details of usage. Example:

Exceptions

License

The Laravel Dotenv Editor is open-source software licensed under the MIT license.

Thanks for use

Hopefully, this package is useful to you.


All versions of dotenv-editor with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/config Version >=5.0
illuminate/container Version >=5.0
illuminate/support Version >=5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mifesta/dotenv-editor contains the following files

Loading the files please wait ....