flipboxdigital / transform
Transform data structures
Installs: 18 778
Dependents: 4
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >=7.0.0
Requires (Dev)
- phpunit/phpunit: ^5.0
- squizlabs/php_codesniffer: ^2.0
This package is auto-updated.
Last update: 2024-10-09 14:24:54 UTC
README
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.