Download the PHP package vansari/php-csv without Composer
On this page you can find all versions of the php package vansari/php-csv. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vansari/php-csv
More information about vansari/php-csv
Files in vansari/php-csv
Package php-csv
Short Description Simple CSV Reader/Writer library
License Apache-2.0
Homepage https://www.vansari.de/projects/php/csv/
Informations about the package php-csv
php-csv
Simple CSV Reader/Writer as a learning project.
Set the options with an Strategy for Read and Write
- Basic features: Read CSV with different Delimiters, Enclosures, Escapes
- Extra Options: set the Encoding for read/write csv. (Read file with given encoding, Write file with given encoding) skip a number of leading lines (read only) do you want to skip empty Records? (read only) has the csv a header?
Functionality of the Reader
- Set that the Reader should normalize the header (Replacing unknown Chars or replace WS with underscore etc)
- read only the Header
- count the Fields
- read one Record
- read all Records
- read a Record at a Line Index (zerobased without header)
- read Records from a Range n to n (zerobased without header)
Usage of the Reader:
The Writer
The Writer uses the same Strategy, Encoding etc as the Reader. Also the usage is very simple.
Options for Write take a look at the top of this File
...
Functionality of the Writer
- instantiate the writer with targetPath (optional), filename (optional) and if you want to append (default false) the content to the file
- Writer instantiates the standard Strategy in the constructor
- set the Header with an array of strings which are not empty (null or '')
- you can normalize the Header with the HeaderNormalizer
- write only one Record (Write the record to temporary file)
- write an array of Records (Write the records to temporary file)
- and write Records to csv File
- get Tempfilepath for moving the temporary file to the expected csv
Usage of the Writer
Benefit
use the Reader and Writer as a composition
What is planned?
I will implement an Transformer which should transform the Values from string to php int, float etc and vis versa. It should also normalize the float values with different decimal character.
If you have any questions or ideas don't hesitate to contact me. Your are free to copy, fork or support this little project ;-)
All versions of php-csv with dependencies
ext-mbstring Version *