2017 © Pedro Peláez
 

library data-converter

In web application we need to convert data from one type to another. For example, array to excel file or excel file to array.

image

digitaldream/data-converter

In web application we need to convert data from one type to another. For example, array to excel file or excel file to array.

  • Friday, September 8, 2017
  • by digitaldreams
  • Repository
  • 2 Watchers
  • 3 Stars
  • 129 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 3 Versions
  • 2 % Grown

The README.md

data-converter

something in web application we need to convert data from excel file to array, array to excel file and more., (*1)

How to install

  "require-dev": {
     "digitaldream/data-converter": "1.0.*"
}

Features

  1. Excel to Array and associative array (if first row marked as heading)
  2. Excel to json(json to excel)
  3. Excel to text(text to excel)
  4. Filter data while import from excel,json,txt,csv
  5. And from one format you can exchange other easily

Uses

Example 01, (*2)

$fileManager = new \DataConverter\FileExcel();

A lot of other configuration like you can define from which row you like to read and how many row it will be read. Also you can append data to file., (*3)


$config = [ 'file_path' => 'C:\Users\Tuhin\Downloads\apiv1567623ccbcfc1_570a009e10650.xlsx', 'first_row_as_headline' => true, ]; $data = $fileManager->config($config)->read()->getData(); //$data = $fileManager->config($config)->read()->toJson(); //$data = $fileManager->config($config)->read()->toText(); //$data = $fileManager->config($config)->read()->toAssoc(); print_r($data); ?>

Example 02, (*4)


//Here it will process the file based on file mimetype. $fileFullPath='test.txt'; $fileManager = \DataConverter\FileManager::initByFileType($fileFullPath); if ($fileManager === FALSE) { // exit() File tye does not mathch } //here we used filter. It will take only these two columns value and other data from the souce will be ignored. $data = $fileManager->config($config)->read()->makeAssoc()->filter(['column_1','column_2])->getData();

Example 03, (*5)

 $fileManager = new \DataConverter\FileExcel();
 $configFile = [ 
     'file_path' => $fullPath,// full file path where file will be saved.     
       'data' => $data,//data as associative array.       
       'mode' => 'w+'//only valid if file type is txt       
    ];
  $fileManager = $fileManager->config($configFile)->filter(['column 1','column 2'])->write(true);

More examples is in demo/exmaples.php file, (*6)

The Versions

08/09 2017

dev-master

9999999-dev https://github.com/digitaldreams/data-converter

In web application we need to convert data from one type to another. For example, array to excel file or excel file to array.

  Sources   Download

MIT

The Requires

 

excel to array array to excel

10/09 2016

1.0.1

1.0.1.0 https://github.com/digitaldreams/data-converter

In web application we need to convert data from one type to another. For example, array to excel file or excel file to array.

  Sources   Download

MIT

The Requires

 

excel to array array to excel

17/06 2016

1.0.0

1.0.0.0 https://github.com/digitaldreams/data-converter

In web application we need to convert data from one type to another. For example, array to excel file or excel file to array.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

excel to array array to excel