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
其他信息
- 授权协议: GPL-2.0-only
- 更新时间: 2022-12-07