承接 uvodohq/menv 相关项目开发

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

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

uvodohq/menv

最新稳定版本:v2.0.0

Composer 安装命令:

composer require uvodohq/menv

包简介

PHP library to modify values in env file

README 文档

README

A PHP library to modify values and comments in .env files.

Installation

$ composer require iziphp/menv

Basic Usage

<?php

use Easy\Menv\Env;

$path = '/path/to/.env';
$env = new Env($path);

// Modify the value of the ENVIRONMENT env var.
$env->set('ENVIRONMENT', 'prod');

// Value might be string, numeric or boolean. String 'false' (case insensitive)
// will be converted to 0, string 'true' (case insensitive) will be converted to
// the 1. Boolean values will ve converted 1 or 0. Strings will be wrapped with
// double quotes when necessary.

// Followings are all same
$env->set('DEBUG', true);
$env->set('DEBUG', 'true');
$env->set('DEBUG', '1');
$env->set('DEBUG', 1);

// You can path the 3rd optional parameter to change the entry comment.
// # symbol will be added automatically to the beginning of the comment.
$env->set('DB_HOST', 'localhost', 'The hostname on which the database server resides.');

// You can also modify the entry lines by index. Indices are the line number
// and start with 0. For example to change the endty at line number 3 use:
$env->setByIndex(2, $value, $optionalComment);

// If you want to change only comment, use following methods:
$env->setComment('KEY', $comment);
$env->setCommentByIndex($index, $comment);

// Call save method to save the changes back to the .env file
$env->save();

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-01-07