Download the PHP package plumphp/plum-csv without Composer
On this page you can find all versions of the php package plumphp/plum-csv. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download plumphp/plum-csv
More information about plumphp/plum-csv
Files in plumphp/plum-csv
Package plum-csv
Short Description PlumCsv includes CSV readers and writers for Plum. Plum is a data processing pipeline for PHP.
License MIT
Informations about the package plum-csv
PlumCsv includes CSV readers and writers for Plum. Plum is a data processing pipeline for PHP.
PlumCsv includes CSV readers and writers for Plum. Plum is a data processing pipeline for PHP.
Developed by Florian Eckerstorfer in Vienna, Europe.
Installation
You can install Plum using Composer.
Usage
Please refer to the Plum documentation for information about Plum in general.
Currently PlumCsv contains a reader and a writer for CSV files and uses League\CSV to actually read and write CSV files.
CsvReader
You can use the Plum\PlumCsv\CsvReader
to read data from a .csv
file.
Optionally you can also pass the delimiter and enclosure to the constructor.
Most CSV files have a header row. Because Plum processes a CSV file row by row you need to add HeaderConverter
to
change the index of each read item. In addition you can use the SkipFirstFilter
to skip the header row. Both
HeaderConverter
and SkipFirstFilter
are part of the core Plum package.
CsvWriter
The Plum\PlumCsv\CsvWriter
allows you to write the data into a .csv
file.
The second and third argument of __construct()
are optional and by default ,
and "
respectively. In addition
the setHeader()
method can be used to define the names of the columns. It has to be called before the prepare()
.
When you read data dynamically you probably don't want to set the header columns manually. You can call
autoDetectHeader()
to use the array keys of the first item written to CsvWriter
as headers.
If you need to further configure the writer, you can inject an instance of League\Csv\Writer
to
Plum\PlumCsv\CsvWriter
.
Change Log
Version 0.4 (28 October 2015)
- Check if item is array before auto-setting header
- #10 Allow injection of
League\Csv\Writer
Version 0.3.1 (28 April 2015)
- Fix Plum version
Version 0.3 (22 April 2015)
- Add support for ReaderFactory
Version 0.2 (21 April 2015)
- Fix Plum version
Version 0.1 (24 March 2015)
- Initial release
License
The MIT license applies to plumphp/plum.json. For the full copyright and license information, please view the LICENSE file distributed with this source code.