PHP Datafeed Parser / Writer Library
Over the past couple of months we have been developing a library built specifically for parsing and writing data files.
The project is located here: datafeed - PHP Datafeed Library
An adapter based structure is used to make it easy to create different adapters for each component. Please see the components included in this library below.
There are 3 main components to this library:
The File component is designed to read and write data feed files, at present there are the following adapters:
- Dynamic (Scans the csv file for it's format automatically - loaded by default)
- Standard (Delimiter ',' - Enclosure '"' - Escape '\' - Line ending '\n')
- YAML (Awaiting development)
- JSON (Awaiting development)
- XML (Awaiting development)
The Archive component allows for adding multiple files to a zip file (or similar). There are the following adapters for the Archive component:
- Tar (Awaiting development)
- bzip (Awaiting development)
The transfer component is designed to move files from one place to another. We have written a Stream adapter that allows us to send / receive a file to/from http, https, ftp (active mode), ftps and sftp if you have the PECL SSH2 extension loaded in PHP (Guide for Ubuntu here). In total there are two active Transfer adapters and some planned ones:
- Ftp (Allows active or passive mode)
- Local (Awaiting development)
We have created some examples of how you can quickly and easily use this code here: Example Usage. This is by no means extensive is an example only. The more you explore the library, the more you will be able to appreciate how powerful and flexible it is.
This is an open source project release under the New BSD License.
We are looking for some developers to contribute to this project and help us finish the library by helping to develop the component adapters above that are marked as "(Awaiting development)".
This is an adapter based system that allows for easy development. Modelled on the Zend Framework Zend_Db_Adapter system of Adapters, making use of the Abstract/Interface design pattern. This makes developing adapters easy to do individually and make them unit testable in isolation.
For a robust library, everything is unit tested using PHPUnit. We have also made use of VFS Stream to Mock and test the File adapters. There are the odd things that cannot be directly unit tested like the FTP Transfer adapter as the FTP instance cannot be mocked.
If you are interested in contributing to this library, please get in contact with us using the contact details on the Google Code Project Page.