Download the PHP package akbardwi/laravel-env-editor without Composer

On this page you can find all versions of the php package akbardwi/laravel-env-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 laravel-env-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.8 and later.

Documentation

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

Installation

You can install this package through Composer. At the root of your application directory, run the following command (in any terminal client):

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/laravel-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 Akbardwi\LaravelEnvEditor\Facades\LaravelEnvEditor. 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 Akbardwi\LaravelEnvEditor\LaravelEnvEditor class into your controller or other classes.

Example:

Loading file for working

By default, the Laravel Dotenv Editor will load the dotenv file that Laravel is reading from in your project. That is, if your Laravel is using the .env.local file to store the configuration values, the Laravel Dotenv Editor also loads the content from that file by default.

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 entries.

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:

Reading data of the specific key

Method syntax:

Example:

Determine if a key exists

Method syntax:

Example:

Get value of a key

Method syntax:

Example:

Edit file content

To edit file content, you have two jobs:

Always keep in mind that the contents of the buffer and the dotenv file will not be the same unless you have saved the contents.

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:

Set comment for an existing setter

Method syntax:

Example:

Set export status for an existing setter

Method syntax:

Example:

Delete a setter entry in buffer

Method syntax:

Example:

Delete multi setter entries in buffer

Method syntax:

Example:

Check if the buffer has changed from dotenv file content

Method syntax:

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.
InvalidKeyException When the key of setter is invalid.
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 © Akbar Dwi Syahputra


All versions of laravel-env-editor with dependencies

PHP Build Version
Package Version
Requires illuminate/console Version ^11.0|^10.0|^9.0|^8.0|^7.0|^6.0|^5.8
illuminate/contracts Version ^11.0|^10.0|^9.0|^8.0|^7.0|^6.0|^5.8
illuminate/support Version ^11.0|^10.0|^9.0|^8.0|^7.0|^6.0|^5.8
jackiedo/path-helper Version ^1.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 akbardwi/laravel-env-editor contains the following files

Loading the files please wait ....