Download the PHP package kedrigern/data-table without Composer
On this page you can find all versions of the php package kedrigern/data-table. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kedrigern/data-table
More information about kedrigern/data-table
Files in kedrigern/data-table
Package data-table
Short Description Manipulation with table organized collection of data (csv, excel). Contains functions for work with whole columns, rows, filtering etc.
License BSD-3-Clause GPL-3.0
Homepage https://github.com/Kedrigern/data-table
Informations about the package data-table
Data table
For robust manipulation with table organized collection of data (excel, csv tables).
Provide ability to work with whole rows and columns, call callbacks, resort, rename, filter. Include few predefined callbacks. See examples.
Import csv and array. Export to plain array, text, html, csv. Export is suitable for DB frameworks (Nette\Database).
Install
The best way how to install is use Composer:
Run tests: vendor/bin/tester -c test/ test/
Examples
Suppose:
$newTable contains:
CSV with header
Very common issue when you have some data in csv with header and you need only subset:
Where table2 contains column Alpha renamed to A and column Beta renamed to B. See test.
Remove if
Remove all rows with even number in first column:
In removed are number of modified rows.
Parse datetime
Now Born seems: ["Jan 90", "Feb 91"], and registered: ["1388361723", "1419897723"]
Join and split columns
In Fullname column you get: ["Jane Roe", "John Doe"].
Or opposite way:
Callbacks
Predefined callbacks:
- join
- joinWith
- split
- toDatetime
- isEven
- isOdd
- allowValues
- disallowValues
- unicodeTrim
Author and contact
- Ondřej Profant, 2014
- issues