PHP code example of keboola / csvmap
1. Go to this page and download the library: Download keboola/csvmap library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
keboola / csvmap example snippets
$data = [
[
'id => '123',
'key' => [
'nested' => 'value1'
]
]
];
$mapping = [
'id' => [
'type' => 'column',
'mapping' => [
'destination' => 'id',
'primaryKey' => true,
]
],
'key.nested' => 'mappedKey'
];
$rootType = 'rootName';
$userData = [];
$parser = new Mapper($mapping, $writeHeader, $rootType);
$parser->parse($data, $userData);
$files = $parser->getCsvFiles();
$tempFilePath = $files['rootName']->getPathName();