承接 climbx/dotenv 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

climbx/dotenv

Composer 安装命令:

composer require climbx/dotenv

包简介

.env files manager

关键字:

README 文档

README

Build Status Maintainability Test Coverage

Dotenv component parses .env files and add them to both $_ENV and $_SERVER.

Install

$ composer require climbx/dotenv

Usage

# .env

foo=bar
bar=baz
// PHP

use Climbx\Dotenv\Dotenv;

$dotenv = new Dotenv();
$envPath = __DIR__ . '/.env';

/*
 * Loads env vars into $_ENV and $_SERVER
 * without overwriting existing variables
 */
$dotenv->load($envPath);

/*
 * Loads env vars into $_ENV and $_SERVER
 * if a variable already exists, it is overridden.
 */
$dotenv->overload($envPath);

Env files syntax

# Comment line

foo=bar                                 # End line comment
bar='this is a single quotted value'    # allows whitespaces
baz="this is a double quotted value"   
num=1234

Variables references

Simple var reference:

foo=bar
baz=$foo        # outputs ['baz' => 'bar']

Multiple var references:

foo=1
bar=2

spaced="$foo and $bar"   # outputs ['spaced' => '1 and 2']
collapsed=$one$two       # outputs ['collapsed' => '12']

Partial var references:

foo="one"
bar="two"

baz=${foo}/${bar}/three      # outputs ['baz' => 'one/two/three']

Escaped var declaration char

foo=bar
echaped1=\$foo   # outputs ['echaped1' => '$foo']
echaped2=\${foo} # outputs ['echaped2' => '${foo}']

Missing var reference.
Missing references don't throw an exception. If a reference is not found, the value is set to an empty string.

missing1=$foo     # outputs ['missing1' => '']
missing2=${foo}  # outputs ['missing2' => '']

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-06-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固