PHP Classes
elePHPant
Icontem

PHP Split CSV: Split CSV files input multiple parts set by rules

Recommend this page to a friend!
  Info   View files View files (21)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2014-05-02 (2 years ago) RSS 2.0 feedNot enough user ratingsTotal: 323 This week: 1All time: 6,815 This week: 1,047Up
Version License PHP version Categories
split-csv 1.0.0BSD License5.3.0PHP 5, Files and Folders
Description Author

This package can split CSV files input multiple parts set by rules.

It can read CSV files by row and write their contents to new multiple CSV files.

The package provides classes that implement different rules for defining where to split the original CSV file.

Currently it provides a rule class that splits the file by size and other to split the file by number of record rows.

Picture of Sergii Pryz
  Performance   Level  
Name: Sergii Pryz <contact>
Classes: 6 packages by
Country: Ukraine Ukraine
Innovation award
Innovation award
Nominee: 2x

Details
SplitCSV
========

Objective
---------
SplitCSV helps to split comma separated value file (CSV) into chunks by configurable options:

  * Each file's part contains first row from original file (or several one)
  * Every file's part has name as original but with a prefix

Of course it is not possible to implement all varies of algorithms of splitting. 
Therefore SplitCSV presents AbstractRule and RuleInterface to add user rules.

Split Rules
-----------
There are two split rules that is available from box:

  * Split by number of rows
  * Split by file size 

Area of usage
-------------
There are several fields where better have several files instead of one:

  * Project log files to prevent them growing to gigantic size  
  * Reports before sending them off by email
  * Price list from different stores before import them to someone
  * Prepare data for parallel calculation to make possible spread data between servers or processes 

### Example
The example file can be found here: `/Example.php`
  Files folder image Files  
File Role Description
Files folder imagedocs (1 directory)
Files folder imagesrc (1 file, 1 directory)
Files folder imagetests (2 files, 2 directories)
Accessible without login Plain text file CHANGELOG.md Data Documentation
Accessible without login Plain text file Example.php Example Example script
Accessible without login Plain text file LICENSE.txt Lic. Documentation
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  docs  
File Role Description
Files folder imageuml (1 file)

  Files folder image Files  /  docs  /  uml  
File Role Description
  Accessible without login Image file class.diagram.png Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
Files folder imageSplitCSV (4 files, 1 directory)
  Accessible without login Plain text file Autoload.php Aux. Class source

  Files folder image Files  /  src  /  SplitCSV  
File Role Description
Files folder imageRule (5 files)
  Plain text file AbstractFile.php Class Class source
  Plain text file Exception.php Class Class source
  Plain text file File.php Class Class source
  Plain text file FileInterface.php Class Class source

  Files folder image Files  /  src  /  SplitCSV  /  Rule  
File Role Description
  Plain text file AbstractRule.php Class Class source
  Plain text file Exception.php Class Class source
  Plain text file FileSize.php Class Class source
  Plain text file NumberRow.php Class Class source
  Plain text file RuleInterface.php Class Class source

  Files folder image Files  /  tests  
File Role Description
Files folder imagedata (1 file)
Files folder imagesrc (1 directory)
  Accessible without login Plain text file bootstrap.php Aux. Class source
  Accessible without login Plain text file phpunit.xml Data Auxiliary data

  Files folder image Files  /  tests  /  data  
File Role Description
  Accessible without login Plain text file test-10000-rows-357kb.csv Data Auxiliary data

  Files folder image Files  /  tests  /  src  
File Role Description
Files folder imageSplitCSV (2 files, 1 directory)

  Files folder image Files  /  tests  /  src  /  SplitCSV  
File Role Description
Files folder imageRule (1 file)
  Accessible without login Plain text file BaseTest.php Test Unit test script
  Accessible without login Plain text file FileTest.php Test Unit test script

  Files folder image Files  /  tests  /  src  /  SplitCSV  /  Rule  
File Role Description
  Accessible without login Plain text file RuleTest.php Test Unit test script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:323
This week:1
All time:6,815
This week:1,047Up