定制 cstuder/parse-valueholder 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

cstuder/parse-valueholder

Composer 安装命令:

composer require cstuder/parse-valueholder

包简介

PHP value holder objects for `parse-hydrodaten` and `parse-swissmetnet`

README 文档

README

PHPUnit tests

PHP value holder objects for parse-hydrodaten and parse-swissmetnet

This simple library provides immutable typed value holder objects (DTO) with the readonly fields timestamp, location, parameter and value.

Also provides a iterable row object containing an array of values and some simple statistic methods, along with a CSV parser.

Example

Installation: composer require cstuder/parse-valueholder

$data = new \cstuder\ParseValueholder\Value(
  $timestamp,
  $locationString,
  $parameterString,
  $value
);

echo $data->timestamp;
echo $data->location;
echo $data->parameter;
echo $data->value;

Row of values

$row = new \cstuder\ParseValueholder\Row([
  $value1,
  $value2
]);

$row->append($value3);

foreach($row as $value) {
  var_dump($value);
}

CSV Parser

A simple CSV parser to parse CSV files without header, in the format timestamp, location, parameter, value, i.e.:

1675281000,BER,tt,5.7

Delimiters, enclosure and escape characters are configurable.

All values are cast to float.

Parses either from a file or from a string:

$row = \cstuder\ParseValueholder\Utils\CsvParser::parseFile($filename);

$row2 = \cstuder\ParseValueholder\Utils\CsvParser::parseString("1675281000,BER,tt,5.7\n1675281600,BER,tt,5.8");

Testing

Run composer test to execute the PHPUnit test suite.

Releasing

  1. Add changes to the changelog.
  2. Create a new tag vX.X.X.
  3. Push.

License

MIT.

Author

Christian Studer cstuder@existenz.ch, Bureau für digitale Existenz.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-08-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固