2017 © Pedro Peláez
 

library array-transform

Transforms raw arrays from a given source mapping and back again

image

mohmann/array-transform

Transforms raw arrays from a given source mapping and back again

  • Tuesday, July 24, 2018
  • by martinohmann
  • Repository
  • 1 Watchers
  • 2 Stars
  • 21 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

array-transform

Latest Stable Version Build Status Coverage Status License PHP 7.1+, (*1)

Transforms raw arrays from a given source mapping to a target mapping and back again., (*2)

This package requires PHP 7.1 or higher., (*3)

Quick example. Given the following YAML mapping:, (*4)

---
mapping:
  foo[int]:
    inverse: bar.baz[float]
    formula:
      direct: bar.baz / 1000
      inverse: foo * 1000

A php array that looks like this (1):, (*5)

[
    'bar' [
        'baz' => 1000.0
    ],
];

... transforms to this (2) (transform):, (*6)

[
    'foo' => 1;
];

... and can be transformed back to its original form (reverseTransform)*, (*7)

[
    '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., (*8)

*There are weird mapping cases where a reverseTransform is not possible. Refer to the documentation for details., (*9)

Installation

Via composer:, (*10)

composer require mohmann/array-transform

Usage

WIP. Check the examples/ directory for now., (*11)

Documentation

WIP. Check the doc/ directory for a mapping example., (*12)

Development / Testing

Refer to the Makefile for helpful commands, e.g.:, (*13)

make stan
make test
make inf

License

array-transform is released under the MIT License. See the bundled LICENSE file for details., (*14)

The Versions

24/07 2018