2017 © Pedro Peláez
 

library csvmapper

CSV parser with callbacks on fields

image

fbk/csvmapper

CSV parser with callbacks on fields

  • Monday, December 15, 2014
  • by danieleorler
  • Repository
  • 2 Watchers
  • 1 Stars
  • 37 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 2 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

CSVMapper

Official repo stats, (*1)

Build Status Coverage Status Scrutinizer Quality Score, (*2)

CSVMapper is a PHP library which parses CSV files., (*3)

It allows to map the file to an array by defining some file configurations and each (wanted) columns properties., (*4)

File Settings

CSVMapper needs to now where the file is located and which is the columns separator., (*5)

It il also possible to specify how many columns are expected so that it aborts if the number of columns doesn't match., (*6)

    $setting = new SettingManager();
    $config->set_setting('folder','./tests');
    $config->set_setting('filename','myfile.csv');
    $config->set_setting('separator',';');
    $config->set_setting('columns_allowed',3);

Mappings

CSVMapper extracts only the columns which are defined with mappings. With a mapping it is possible to specify the position of the column, which function to apply to the value and how to test the value., (*7)

    $mapping = new MappingManager();
    // retrieve column number 1 (counting from 0) and label it as year
    $mapping->set_mapping("year", array('key'=>1,'fn'=>FALSE,'test'=>FALSE));
    // retrieve column number 2 (counting from 0) and label it as temperature, apply to each value the function 'return floatval($input);'
    $mapping->set_mapping("temperature", array('key'=>2, 'fn'=>create_function('$input','return floatval($input);'),'test'=>FALSE));

The Versions

15/12 2014

dev-master

9999999-dev https://github.com/danieleorler/CSVMapper

CSV parser with callbacks on fields

  Sources   Download

MIT

The Requires

 

The Development Requires

csv

15/12 2014

0.1.1

0.1.1.0 https://github.com/danieleorler/CSVMapper

CSV parser with callbacks on fields

  Sources   Download

MIT

The Requires

 

The Development Requires

csv

04/11 2014

dev-dev

dev-dev https://github.com/danieleorler/CSVMapper

CSV parser with callbacks on fields

  Sources   Download

MIT

The Requires

 

The Development Requires

csv

18/02 2014

dev-no-memory

dev-no-memory https://github.com/danieleorler/CSVMapper

CSV parser with callbacks on fields

  Sources   Download

MIT

The Requires

 

The Development Requires

csv

10/12 2013

0.1.0

0.1.0.0 https://github.com/danieleorler/CSVMapper

CSV parser with callbacks on fields

  Sources   Download

MIT

The Requires

 

The Development Requires

csv

31/08 2013

0.0.2

0.0.2.0 https://github.com/danieleorler/CSVMapper

CSV parser with callbacks on fields

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

csv

23/08 2013

0.0.1

0.0.1.0 https://github.com/danieleorler/CSVMapper

CSV parser with callbacks on fields

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

csv