Download the PHP package xayan/dataflow without Composer
On this page you can find all versions of the php package xayan/dataflow. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package dataflow
DataFlow
A multi-purpose data manipulation library
A data manipulation library is meant to, well, manipulate data. This library introduces two main classes: Entity
and EntityCollection
. The first one accumulates data, the second one allows batch operations on entities. But that's not all, another feature of this library is data import/export. As for now, only CSV files are supported, but more are to come. That way you can easily make scripts that will import some data, process it and then output it in desired form (a string or a file).
Installation
Package is available through composer:
composer require xayan/dataflow
Usage
Let's assume the following CSV file:
λ cat your_file.csv
Now, let's say we want to filter this data to contain only adults. Also, I don't like the fact that first name and last name are separated. So let's change that:
If you execute this script, the output should look like this:
λ cat another_file.csv
Features
Current version of the library is v1.0. Only the basic features are implemented, but they still have some potential.
What it can do now
- Each Entity can have any number of properties of any primitive type
- EntityCollection implements basic functions for data manipulation, that is:
each
,map
,count
andfilter
- Import from and export to CSV - you can specify from which columns/properties data should be imported to/exported from, and whether to throw exceptions or not when data is missing
- Full unit tests are implemented to make sure future changes won't mess up current functionality
Plans for the future
- JSON support
- PDO support
- Child entities
- Type definitions
- Data validation
Footnotes
This library is a private project and I can't guarantee it will work 100% of the time.