Download the PHP package myclabs/xport without Composer
On this page you can find all versions of the php package myclabs/xport. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download myclabs/xport
More information about myclabs/xport
Files in myclabs/xport
Informations about the package xport
Xport
Xport is an import/export library for PHP.
It is targeted to support the following formats:
- Excel (xlsx and xls)
- OpenOffice (ods - to be implemented)
- PDF (to be implemented)
- XML (to be implemented)
It provides an object model for different formats (spreadsheet, document, XML…) and a language based on YAML and Twig to map your data (arrays, objects, …) onto the model.
Spreadsheet
Simple example
Simple mapping file (YAML file):
Usage:
The table will be filled with each item in the array $contacts
.
The path
configuration is a PropertyAccess path, e.g. the contact.phoneNumber
path can resolve to $contact->getPhoneNumber()
or $contact->phoneNumber
.
Dynamic example
You can use the foreach
expression to generate dynamic content.
You can also use Twig templating language.
Here is an example:
Here is a more complete example:
Functions
Functions can be used in Twig expressions, and are defined as such:
File format
You can choose which file format to use through PHPExcel writers:
Writers available:
- Excel 2007 (.xlsx):
PHPExcel_Writer_Excel2007
- Excel classic (.xls):
PHPExcel_Writer_Excel5
- CSV (.csv):
PHPExcel_Writer_CSV
All versions of xport with dependencies
symfony/yaml Version 2.*
symfony/property-access Version 2.*
phpoffice/phpexcel Version 1.7.*
twig/twig Version 1.*
mnapoli/metamodel Version dev-master