dennis84 / mapped
A lightweight data transformation and validation tool.
dev-master
2015-12-09 11:08 UTC
Requires
- php: >=5.4.0
Requires (Dev)
- doctrine/common: 2.*
- phpunit/phpunit: ^4.6
- symfony/property-access: 2.*
- symfony/validator: 2.*
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.
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.