1. Go to this page and download the library: Download digitaldream/data-converter 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/ */
//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();
$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);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.