定制 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
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固