Skip to content
Alexey Pavlyuts edited this page Feb 1, 2023 · 5 revisions

Profile-based multistring CSV objects handling library


Warning: the documantation is not up to the code for now, I will rework it


Purpose

There a lot of scenarions for CSV format used to export/import structured documents with more complex structure: some of fields are document-level and repeated each row and other fields are row-level. The most common e[ample is an invoice: Csutomer ID and name, billing address and other header-level fields are repeating ech row while other columns contains invoice rows data like sell item, count and price.

The idea behing the library is to provide easy and configurable gear to handle this kind of "structured CSV", based on "profile", describig CSV file structures and handling rules.

So, with this lib you need:

  • Create CSV "profile" data structure to define processing rules
  • Create collecton from file and got an array of class instances, representing the CSV encoded entities

In a simple case you need no extra code. For more complex scenarios you may extent Entity class with your features or add field processing functions.

Documentaton

Installation

In the Composer storage. Just add proper require section:

"require": {
    "pavlyuts/portabilling": "*"
}

It is a good idea to fix the version you use. Don't use next version without review, I can't promose backward compatibility even will try to keep it. Please, review the changelog before to change used version.

Dependencies

  • php: >=7.1
  • league/csv: ^9.0