mohmann/array-transform
Composer 安装命令:
composer require mohmann/array-transform
包简介
Transforms raw arrays from a given source mapping and back again
README 文档
README
Transforms raw arrays from a given source mapping to a target mapping and back again.
This package requires PHP 7.1 or higher.
Quick example. Given the following YAML mapping:
---
mapping:
foo[int]:
inverse: bar.baz[float]
formula:
direct: bar.baz / 1000
inverse: foo * 1000
A php array that looks like this (1):
[
'bar' [
'baz' => 1000.0
],
];
... transforms to this (2) (transform):
[
'foo' => 1;
];
... and can be transformed back to its original form (reverseTransform)*
[
'bar' [
'baz' => 1000.0
],
];
Simple formulas and type definitions are some of the "advanced" features of array-transform. Please refer to the documentation for more details.
*There are weird mapping cases where a reverseTransform is not possible. Refer to the documentation for details.
Installation
Via composer:
composer require mohmann/array-transform
Usage
WIP. Check the examples/ directory for now.
Documentation
WIP. Check the doc/ directory for a mapping example.
Development / Testing
Refer to the Makefile for helpful commands, e.g.:
make stan
make test
make inf
License
array-transform is released under the MIT License. See the bundled LICENSE file for details.
统计信息
- 总下载量: 185
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-07-21