Download the PHP package thegr8dev/dotenv-editor without Composer

On this page you can find all versions of the php package thegr8dev/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 the .env file editor (or files with same structure and syntax) for Laravel 5.8+. Now you can easily edit .env files with the following features:

Versions and compatibility

Laravel Dotenv Editor is compatible with Laravel 5+ and above. Since the release of 1.2.0 onwards, this package only supports Laravel 5.8 and later. Previous versions of Laravel will no longer be supported.

Note for the release 1.2.0 and later

Starting with the release 1.2.0, the .gitignore file in the folder containing the backup file will no longer be created automatically. Developers will have to create this file manually if deemed necessary.

Documentation

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

Installation

You can install this package through Composer with the following steps:

Step 1 - Require package

At the root of your application directory, run the following command (in any terminal client):

Note: Since Laravel 5.5, service providers and aliases are automatically registered, so you can safely skip the following two steps:

Step 2 - Register service provider

Open config/app.php, and add a new line to the providers section:

Step 3 - Register facade

Add the following line to the aliases section in file config/app.php:

Configuration

To start using the package, you should publish the configuration file so that you can configure the package as needed. To do that, run the following command (in any terminal client) at the root of your application:

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. Currently there are the following settings:

Auto backup mode

The autoBackup setting allows your original file to be backed up automatically before saving. Set it to true to agree.

Backup location

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

Always create backup folder

The alwaysCreateBackupFolder setting is used to request that the backup folder always be created, whether or not the backup is performed.

Usage

Working with facade

Laravel Dotenv Editor has a facade with the name Jackiedo\DotenvEditor\Facades\DotenvEditor. You can perform all operations through this facade.

Example:

Using dependency injection

This package also supports dependency injection. You can easily inject an instance of the Jackiedo\DotenvEditor\DotenvEditor class into your controller or other classes.

Example:

Loading file for working

By default, Laravel Dotenv Editor will load the .env file in the root of your project. Example:

However, if you want to explicitly specify the files you are going to work with, you should use the load() method.

Method syntax:

Example:

Note: The load() method has three parameters:

Reading file content

Reading raw content.

Method syntax:

Example:

Reading content by lines.

Method syntax:

Example:

Note: This will return an array. Each element in the array consists of the following items:

Reading content by keys

Method syntax:

Example:

Note: This will return an array. Each element in the array consists of the following items:

Determine if a key exists

Method syntax:

Example:

Get value of a key

Method syntax:

Example:

Writing content into a file

To edit file content, you have two jobs:

Add an empty line into buffer

Method syntax:

Example:

Add a comment line into buffer

Method syntax:

Example:

Add or update a setter into buffer

Method syntax:

Example:

Add or update multi setter into buffer

Method syntax:

Example:

Alternatively, you can also provide an associative array of keys and values:

Delete a setter line in buffer

Method syntax:

Example:

Delete multi setter lines in buffer

Method syntax:

Example:

Save buffer into file

Method syntax:

Example:

Backing up and restoring file

Backup your file

Method syntax:

Example:

Get all backup versions

Method syntax:

Example:

Get latest backup version

Method syntax:

Example:

Restore your file from latest backup or other file

Method syntax:

Example:

Delete one backup file

Method syntax:

Example:

Delete multi backup files

Method syntax:

Example:

Change auto backup mode

Method syntax:

Example:

Method chaining

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

Working with Artisan CLI

Now, Laravel Dotenv Editor has 6 commands which can be used easily with the Artisan CLI. These are:

Please use each of the commands with the --help option to leanr more about there usage.

Example:

Exceptions

This package will throw exceptions if something goes wrong. This way it's easier to debug your code using this package or to handle the error based on the type of exceptions.

Exception Reason
FileNotFoundException When the file was not found.
InvalidValueException When the value of setter is invalid.
KeyNotFoundException When the requested key does not exist in file.
NoBackupAvailableException When no backup file exists.
UnableReadFileException When unable to read the file.
UnableWriteToFileException When unable to write to the file.

Contributors

This project exists thanks to all its contributors.

License

MIT © Jackie Do


All versions of dotenv-editor with dependencies

PHP Build Version
Package Version
Requires illuminate/console Version ^5.8|^6.0|^7.0|^8.0|^9.0
illuminate/contracts Version ^5.8|^6.0|^7.0|^8.0|^9.0
illuminate/support Version ^5.8|^6.0|^7.0|^8.0|^9.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 thegr8dev/dotenv-editor contains the following files

Loading the files please wait ....