sbwerewolf/batch-file-scripting 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

sbwerewolf/batch-file-scripting

最新稳定版本:v3.2.4

Composer 安装命令:

composer require sbwerewolf/batch-file-scripting

包简介

Kit of utility classes for batch file scripting

README 文档

README

Kit of utility classes for batch file scripting.

  • EnvReader - parse the .env files to array and define constants or environment variables
  • DurationConverter - prints duration in seconds or nanoseconds with human-readable format
  • Path - glue up file system path

Code examples in test.php

How to install

composer require sbwerewolf/batch-file-scripting

How to use EnvReader

$path = (new Path())->make(['.', 'config', 'test.env',]);
/* .env file location is './config/test.env' */
$env = new SbWereWolf\Scripting\Config\EnvReader($path);

var_dump($env->getVariables());
/*
array(4) {
    'USER' =>
  string(4) "root"
  'PORT' =>
  string(2) "80"
  'DATE' =>
  string(10) "2023-01-25"
  'FLAG' =>
  string(5) "FALSE"
}
*/
$env->defineConstants();
echo constant('USER') . PHP_EOL;
/* root */

$env->defineVariables();
echo getenv('FLAG') . PHP_EOL;
/* FALSE */

How to use DurationConverter

$printer = 
new SbWereWolf\Scripting\Convert\SecondsConverter('%dd, %H:%I:%S');
echo $printer->print(100000.111) . PHP_EOL;
/* 1d, 03:46:40 */

$printer = 
new SbWereWolf\Scripting\Convert\NanosecondsConverter('%dd, %H:%I:%S.%F%N');
echo $printer->print(100000999888777.999) . PHP_EOL;
/* 1d, 03:46:40.999888778 */

$printer = 
new SbWereWolf\Scripting\Convert\NanosecondsConverter('%L ms %U mcs %N ns');
echo $printer->print(99088077.999) . PHP_EOL;
/* 099 ms 088 mcs 077 ns */

How to use Path

$pathMaker = (new SbWereWolf\Scripting\FileSystem\Path());
$path = $pathMaker->make(['.', 'config', 'test.env',]);
echo $path . PHP_EOL;
/* .\config\test.env */

Contacts

Volkhin Nikolay
e-mail ulfnew@gmail.com
phone +7-902-272-65-35
Telegram @sbwerewolf

Chat with me via messenger

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固