kimbee-team/dotenv-dump 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kimbee-team/dotenv-dump

Composer 安装命令:

composer require kimbee-team/dotenv-dump

包简介

Dumps environment variables from `.env` to `.htaccess` or plain PHP-file.

README 文档

README

The DotEnvDumpBundle parses.env files via DotEnv and export environment variables in .htaccess (SetEnv directive) or .php (return array) formats.

The main purpose of this bundle to use it as a part of a deploy process for a shared hosting where you can't edit environment variables.

During development, you'll use the .env file to configure your environment variables. On your production server, it is recommended to configure these at the web server level.

So if you're using Apache, you can pass these variables via SetEnv directive in .htaccess file.

Or you can just cache them into .env.php file and replace in your front controller (index.php):

(new Dotenv())->load(__DIR__.'/../.env');

with something like

if (file_exists(__DIR__.'/../.env.php')) {
   $variables = require_once __DIR__.'/../.env.php';
   (new Dotenv())->populate($variables);
}

Usage

bin/console dotenv:dump [--htaccess] [--php] [path-to-output-file] [path-to-env-file]

Invoked with no parameters will export to .htaccess in the %kernel.project_dir%.

It's a safe to invoke command few times in a row.

Example

bin/console dotenv:dump --htaccess .htaccess will prepend (or replace if already exists) in the .htaccess following content:

###> .env ###
SetEnv "APP_ENV" "dev"
SetEnv "APP_SECRET" "6d15395b9c94f12f97fa31edc9c0c6f0"
###< .env ###

bin/console dotenv:dump --php .env.php will rewrite .env.php file with the following content:

<?php return array (
  'APP_ENV' => 'dev',
  'APP_SECRET' => '6d15395b9c94f12f97fa31edc9c0c6f0',
);

Installation

Applications that use Symfony Flex

Open a command console, enter your project directory and execute:

$ composer require kimbee-team/dotenv-dump

###Applications that don't use Symfony Flex

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require kimbee-team/dotenv-dump

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new \KimbeeTeam\DotenvDump\KimbeeTeamDotenvDumpBundle(),
        );

        // ...
    }

    // ...
}

License

This bundle is released under the MIT license

统计信息

  • 总下载量: 169
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-07-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固