mehr-it/data-interchange-format
Composer 安装命令:
composer require mehr-it/data-interchange-format
包简介
Data interchange format (DIF) writer
README 文档
README
This package implements a simple data interchange format (DIF) writer.
Usage
To create a DIF file, columns with data types have to be specified and the data has to be passed as array to the writer:
(new DifWriter())
->columns([
'Text' => DifWriter::TYPE_STRING,
'Number' => DifWriter::TYPE_NUMERIC,
])
->data([
[
'Text' => 'hello',
'Number' => 1,
],
[
'Text' => 'this is me',
'Number' => -3.5,
],
])
->writeTo($target)
Input/output encoding may be specified as well as the linebreak to use using the corresponding setter functions of the writer class.
By default the column headers are output as first line. To disable column header output, simply
pass false as second argument to the columns() method:
$writer->columns([
'Text' => DifWriter::TYPE_STRING,
'Number' => DifWriter::TYPE_NUMERIC,
], false);
统计信息
- 总下载量: 129
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-01-20