Download the PHP package cranux/laravel-dotenv-editor without Composer

On this page you can find all versions of the php package cranux/laravel-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 laravel-dotenv-editor

由于使用laravel6.x不兼容 所以此项目由 Brotzka/laravel-dotenv-editor 修改并完善功能,在此感谢原项目作者

Edit your Laravel .env file

This package offers you the possibility to edit your .env dynamically through a controller or model.

The current version (2.x) ships with a graphical user interface based on VueJS to offer you a very simple implementation of all features.

List of available functions:

Here are some images showing the gui which ships with the current version:

Installation

Via composer require

Install the package via the composer require command:

composer require cranux/laravel-dotenv-editor

Add the package manually

Add the following line to your composer.json require section:

"require": {
    //other packages
    "cranux/laravel-dotenv-editor": "^1.0"
}

Then run the composer update command:

composer update

After Installation

Add the following line to your config/app.php providers:

Cranux\DotenvEditor\DotenvEditorServiceProvider::class,

Add the following line to your config/app.php aliases:

'DotenvEditor' => Cranux\DotenvEditor\DotenvEditorFacade::class,

Finally you have to publish the config file and view via:

php artisan vendor:publish --provider="Cranux\DotenvEditor\DotenvEditorServiceProvider"

After an Update, maybe you have to force publish:

php artisan vendor:publish --provider="Cranux\DotenvEditor\DotenvEditorServiceProvider" --force

Be careful, this will overwrite all your published files! It's always better to delete the file manually and then run the command than to run the force version.

Now you can edit the config file and put in your values.

Config

Open the config/dotenveditor.php and fill it up with your values.

Note: I had an issue where I had to switch the web-middleware between and . In Laravel 5.2, put the web-middleware in the array. For Laravel 5.1 put it in the array.

The path to your .env should not be changed.

Deactivate GUI

If you don't want to use the graphical interface, you could deactivate it in the config.

Additional middleware

If you want to add more middlewares to the used routes, you could put them in the arrays.

Examples

The following example shows an controller with a method, in which we change some values from the .env. Make sure, the entries you want to change, really exist in your .env.

namespace App\Http\Controllers;

use Cranux\DotenvEditor\DotenvEditor;
use Cranux\DotenvEditor\DotenvEditorFacade;

class EnvController extends Controller
{
    public function test(){
        $env = new DotenvEditor();

        $env->changeEnv([
            'TEST_ENTRY1'   => 'one_new_value',
            'TEST_ENTRY2'   => $anotherValue,
        ]);
        // 使用门面
        DotenvEditorFacade::changeEnv([
            'TEST_ENTRY1'   => 'one_new_value',
            'TEST_ENTRY2'   => $anotherValue,
        ]);
    }
}

For more exmaples visit the Wiki.

感谢 Brotzka/laravel-dotenv-editor


All versions of laravel-dotenv-editor with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2.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 cranux/laravel-dotenv-editor contains the following files

Loading the files please wait ....