2017 © Pedro Peláez
 

library maparea

A data mapping library.

image

enrise/maparea

A data mapping library.

  • Friday, May 19, 2017
  • by enrise
  • Repository
  • 8 Watchers
  • 3 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Archived and unmaintained

This is an old repository that is no longer used or maintained. We advice to no longer use this repository., (*1)

Original README can be found below:

Maparea Travis build

This is a PHP mapping helper utility. It's useful when you want to convert a certain array-structure into another structure. The definitions could be declared in a yaml-structure, so it's easy to verify the input and of the mapping., (*2)

Definition

The definition is easiest done by using yaml. This project is using JMESpath, so you can define the mapping like this:, (*3)

# route.yml
id:
  from: uuid
distance:
  from: plan.distance
  service_class: \Enrise\DistanceMapper
# map using route.yml
$mapper = new \Enrise\Maparea\Mapper();

$raw = [
    'uuid' => 'F2001E99-98E6-4C50-A965-C694EC44B810',
    'plan' => [
        'distance' => 1223
    ]
];

$mapper = Mapper::withLoader(new YamlLoader(__DIR__."/resources/yaml"));
$mappedData = $mapper->mapDataWithLoader($raw, "route.yaml");

// $mappedData
[
    'id' => 'F2001E99-98E6-4C50-A965-C694EC44B810',
    'distance' => 1.223
]

The Versions

19/05 2017

dev-master

9999999-dev

A data mapping library.

  Sources   Download

The Requires

 

The Development Requires

by Dennis Snijder
by Robert-Jan Keizer
by William Rijksen