Details
DataMapper
Class for mapping data by filters
Instalation
composer require alexmcarrow/datamapper
Using
use AlexMcArrow\DataMapper\DataMapper;
new DataMapper();
DataMapper::setFieldsFilter([
'key' => 'KeyID',
'name' => 'User Name'
]);
$rawdata = [
[
'key' => 'a1',
'name' => 'Alex',
'email' => 'alex@domain.tld'
],
[
'key' => 'b2',
'name' => 'Axel'
]
];
$cleardata = DataMapper::parseMapData($rawdata, DataMapper::$FILTER_PASS_CUT, DataMapper::$FILTER_TYPE_HARD, DataMapper::$MAP_KEY, DataMapper::$MAP_VALUE);
print_r($cleardata);
[
[
'keyid' => 'a1',
'user name' => 'Alex'
],
[
'keyid' => 'b2',
'user name' => 'Axel'
]
]
License
MIT
|
Name: |
PHP Data Mapper |
Base name: |
datamapper |
Description: |
Map array values with data mapper filters |
Version: |
0.0.0 |
PHP version: |
8 |
License: |
The PHP License |
All time users: |
69 users |
All time rank: |
10150 |
Week users: |
0 users |
Week rank: |
257  |
|
|
 December 2022
Number 3 |
Some applications need to process arrays that they receive from external sources like database result queries or external Web service API calls.
Sometimes the arrays do not come in the best format for those applications to process. Therefore they need to process the arrays to transform their values.
This package provides a way to transform the input arrays into other arrays that may have changed the key names of associative arrays or eliminated the array values with specific keys.
Manuel Lemos |
Not yet rated by the users |
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.
|
Files |
|
|
Files |
|