承接 legolabs/phputils 相关项目开发

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

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

legolabs/phputils

最新稳定版本:v0.3

Composer 安装命令:

composer require legolabs/phputils

包简介

Useful PHP classes, matching various purposes

README 文档

README

Useful PHP classes, matching various purposes

EnvReplacer

Replaces markers in selected files with matching environment variable values.

It's very useful into docker containers, when you pass a lot of environment variables to be inserted into local configuration files.

Markers must be compliant with the regular expression /__[A-Z0-9_]{5,30}__/ and corresponding environment variable must be the same without the delimiters (__)

Example

Marker: __MARKER__
Env: MARKER

Usage

Sample file containing markers, e.g php.ini:

...
upload_max_filesize = __UPLOAD_MAX_FILESIZE__
max_file_uploads = __MAX_FILE_UPLOADS__
...

Setting environment variables:

export UPLOAD_MAX_FILESIZE=64M
export MAX_FILE_UPLOADS=20

PHP Script:

use Legolabs\Utils\EnvReplacer\EnvReplacer;

$replacer = new EnvReplacer('/etc/php/8.1/apache/php.ini');
$replacer->apply();

Resulting file:

...
upload_max_filesize = 64M
max_file_uploads = 20
...

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-2.0-only
  • 更新时间: 2022-12-07