1# FINDOLOGIC export toolkit 2 3[![Travis](https://img.shields.io/travis/findologic/libflexport.svg)](https://travis-ci.org/findologic/libflexport) 4[![Latest Stable Version](https://poser.pugx.org/findologic/libflexport/v/stable)](https://packagist.org/packages/findologic/libflexport) 5[![Code Climate](https://codeclimate.com/github/findologic/libflexport.svg)](https://codeclimate.com/github/findologic/libflexport) 6[![Codecov](https://codecov.io/gh/findologic/libflexport/branch/develop/graph/badge.svg)](https://codecov.io/gh/findologic/libflexport) 7 8## Synopsis 9 10This project provides a export library for XML and CSV generation according to the FINDOLOGIC export patterns. 11* XML <https://docs.findologic.com/doku.php?id=export_patterns:xml> 12* CSV <https://docs.findologic.com/doku.php?id=export_patterns:csv> 13 14#### Export recommendation 15 16Using the XML export is recommended by FINDOLOGIC. The XML is easier to read and has some advantages over the CSV export like: 17 18* No encoding issues as the encoding attribute is provided in the XML response `<?xml version="1.0" encoding="UTF-8"?>` 19* Validation is more reliable 20* Simple escaping of content using the `<![CDATA[...]]>`-tag 21* Standardized structure 22* Dynamically extract the products from the database via `start` and `count` parameter in the url 23* No limited file size for XML because of pagination 24* Using multiple usergroups per product 25 26## Basic usage 27 28### Setup 29 301. Include as composer dependency using `composer require findologic/libflexport` 312. Load `./vendor/autoload.php` into the project 32 33### XML export 34 35```php 36require_once './vendor/autoload.php'; 37 38use \FINDOLOGIC\Export\Exporter; 39use \FINDOLOGIC\Export\Data\Price; 40 41$exporter = Exporter::create(Exporter::TYPE_XML); 42 43$item = $exporter->createItem('123'); 44 45$item->addPrice(13.37); 46// Alternative long form: 47// $price = new Price(); 48// $price->setValue(13.37); 49// $item->setPrice($price); 50 51$xmlOutput = $exporter->serializeItems([$item], 0, 1, 1); 52``` 53 54### Examples 55 56For more specific examples, please have a look at the examples directory. 57 58## Contributors 59 60If you want to contribute to this project, feel free to fork the repository. Afterwards you can create a pull request following the steps mentioned at [this Github help page.](https://help.github.com/articles/creating-a-pull-request-from-a-fork/) 61 62Tests should be provided if possible. 63 64Running `php-cs-fixer` before commiting will reduce style-caused build failures. 65