flipboxdigital/transform

There is no license information available for the latest version (3.0.2) of this package.

Transform data structures

3.0.2 2018-11-20 17:06 UTC

This package is auto-updated.

Last update: 2022-11-09 09:58:10 UTC


README

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads

This package provides simple way to transform data.

Installation

To install, use composer:

composer require flipboxdigital/transform

Testing

$ ./vendor/bin/phpunit

Usage

$raw = [
    'firstName' => 'foo',
    'lastName' => 'bar',
    'dateCreated' => new \DateTime(),
    'dateUpdated' => new \DateTime()
];

$data = Flipbox\Transform\Factory::item()
    ->transform(
        function($data) {

            return [
                'name' => [
                    'first' => $data['firstName'],
                    'last' => $data['firstName']
                ],
                'date' => [
                    'created' => $data['dateCreated']->format('c'),
                    'updated' => $data['dateUpdated']->format('c')
                ]
            ];

        },
        $raw
    );

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.