dennis84/mapped

A lightweight data transformation and validation tool.

dev-master 2015-12-09 11:08 UTC

This package is not auto-updated.

Last update: 2024-11-05 02:15:23 UTC


README

A lightweight data transformation and validation tool for PHP.

Build Status Coverage Status

Quick Example

<?php

$factory = new Factory;

$mapping = $factory->mapping([
    'username' => $factory->string(),
    'password' => $factory->string(),
], function ($username, $password) {
    return new User($username, $password);
}, function (User $user) {
    return [
        'username' => $user->username,
        'password' => $user->password,
    ];
});

$user = $mapping->apply([
    'username' => 'dennis',
    'password' => 'passwd',
]);

$data = $mapping->unapply($user);

More examples

Mapped has a pretty comprehensive test coverage that demonstrates the whole bunch of functionality.