power-data-hub / metamorphose
ETL
Installs: 4 955
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 1
Open Issues: 1
Requires
- php: ^7.1.3
- cakephp/chronos: ^1.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.11
- orchestra/testbench: ^3.6
- phpunit/phpunit: ^7.0
This package is auto-updated.
Last update: 2024-12-05 06:07:49 UTC
README
Metamorphose - Transform your data
Here are a few examples on how you can use the package:
use \PowerDataHub\Metamorphose\Transformers\TrimTransformer; use \PowerDataHub\Metamorphose\Metamorphose; $result = app(Metamorphose::class) ->from(['name' => ' John Doe ') ->through(TrimTransformer::class) ->transform(); // Output ['name' => 'John Doe']
You can pass as many transformers as you want:
use \PowerDataHub\Metamorphose\Transformers\TrimTransformer; use \PowerDataHub\Metamorphose\Transformers\PercentTransformer; use \PowerDataHub\Metamorphose\Transformers\NumericTransformer; use \PowerDataHub\Metamorphose\Metamorphose; app(Metamorphose::class) ->from(['name' => ' John Doe ', 'age' => '33', 'score' => '33.987']) ->through([ TrimTransformer::class, PercentTransformer::class, NumericTransformer::class, ]) ->transform(); //Output ['name' => 'John Doe', 'age' => 33, 'score' => 33.99]
Installation
You can install the package via composer:
composer require power-data-hub/metamorphose
Transformers
Metamorphose come with some useful transformers
Trim
use \PowerDataHub\Metamorphose\Transformers\TrimTransformer; app(Metamorphose::class) ->from(['name' => ' John', 'last_name' => ' Doe ']) ->through(TrimTransformer::class) ->transform(); // Output ['name' => 'John', 'last_name' => 'Doe']