FINDOLOGIC export toolkit for XML and CSV data export
This project provides an export library for XML and CSV generation according to the FINDOLOGIC export patterns.
Using the XML export is recommended by FINDOLOGIC. The XML is easier to read and has some advantages over the CSV export like:
<?xml version="1.0" encoding="UTF-8"?>
.<![CDATA[...]]>
-tag.start
and count
parameter in the url.The key advantage for CSV is that it is possible to use way more groups than for XML. On the other hand:
Currently, only input text encoded in UTF-8 is supported. To use this library with other types of encoding, one of the
following is necessary:
libflexport
.composer require findologic/libflexport
./vendor/autoload.php
into the project
require_once './vendor/autoload.php';
use FINDOLOGIC\Export\Exporter;
$exporter = Exporter::create(ExporterType::XML);
$item = $exporter->createItem('123');
$item->addName('Test');
$item->addUrl('http://example.org/test.html');
$item->addPrice(13.37);
// Alternative long form:
// $name = new Name();
// $name->setValue('Test');
// $item->setName($name);
// $url = new Url();
// $url->setValue('http://example.org/test.html');
// $item->setUrl($url);
// $price = new Price();
// $price->setValue(13.37);
// $item->setPrice($price);
$xmlOutput = $exporter->serializeItems([$item], 0, 1, 1);
require_once './vendor/autoload.php';
use FINDOLOGIC\Export\Exporter;
$exporter = Exporter::create(ExporterType::CSV);
$item = $exporter->createItem('123');
$item->addPrice(13.37);
$item->addName('Test');
$item->addUrl('http://example.org/test.html');
// Alternative long form:
// $name = new Name();
// $name->setValue('Test');
// $item->setName($name);
// $url = new Url();
// $url->setValue('http://example.org/test.html');
// $item->setUrl($url);
// $price = new Price();
// $price->setValue(13.37);
// $item->setPrice($price);
// Date is mandatory for CSV.
$item->addDateAdded(new \DateTime());
$csvOutput = $exporter->serializeItems([$item], 0, 1, 1);
For more specific examples, please have a look at the examples directory.
The status of the major versions of libflexport is outlined below. Version numbers generally follow
semantic versioning principles.
Version | Branch | PHP support | Receives bug fixes | Receives enhancements | End of life |
---|---|---|---|---|---|
3.X | develop | >=8.1 | ![]() |
![]() |
Not in the foreseeable future |
2.X | 2.x | >=7.1 | ![]() |
![]() |
Not in the foreseeable future |
1.X | 1.x | 5.6 - 7.3 | ![]() |
![]() |
TBD |
0.X | ![]() |
5.6 - 7.0 | ![]() |
![]() |
2017-11-24 |
All versions will most likely remain available for as long as the infrastructure to do so exists.
See contribution guide.