PHP Classes

PHP Data Mapper: Map array values with data mapper filters

Recommend this page to a friend!

  Author Author  
Picture of Alex McArrow
Name: Alex McArrow <contact>
Classes: 3 packages by
Country: Russian Federation Russian Federation
Innovation award
Innovation award
Nominee: 2x

Winner: 1x


  Detailed description   Download Download .zip .tar.gz  
This class can map array values with data mapper filters.

It can take an array with one or more associative data value arrays and perform several operations to transform it into the output array.

Currently, it can:

- Remove values of specific columns in all rows

- Take values of the input array with specific keys values and map them to other fundamental values of the output array

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


  Classes of Alex McArrow  >  PHP Data Mapper  >  Download Download .zip .tar.gz  >  Support forum Support forum  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
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
 
  Groups   Applications   Files Files  

  Groups  
Group folder image Data types Modeling and manipulating data types View top rated classes
Group folder image Validation Validation algorithms View top rated classes
Group folder image PHP 8 Classes using PHP 8 specific features View top rated classes


  Applications that use this package  
No pages of applications that use this class were specified.

Add link image If you know an application of this package, send a message to the author to add a link here.

  Files folder image Files  
File Role Description
Files folder imagesrc (1 file)
Files folder imagetests (1 file)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file psalm.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
  Plain text file DataMapper.php Class Class source

  Files folder image Files  /  tests  
File Role Description
  Plain text file DataMapperTest.php Class Class source

Download Download all files: datamapper.tar.gz datamapper.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.
  Files folder image Files  
File Role Description
Files folder imagesrc (1 file)
Files folder imagetests (1 file)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file psalm.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
  Plain text file DataMapper.php Class Class source

  Files folder image Files  /  tests  
File Role Description
  Plain text file DataMapperTest.php Class Class source

Download Download all files: datamapper.tar.gz datamapper.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.