Skip to content

Typed Documents and sorted raw data

Compare
Choose a tag to compare
@Dwarfex Dwarfex released this 25 Feb 11:10
c776116

This release adds typed Documents for each API

  • OpenFoodFacts\Document\FoodDocument;
  • OpenFoodFacts\Document\PetDocument;
  • OpenFoodFacts\Document\BeautyDocument;
  • OpenFoodFacts\Document\ProductDocument;
    These all extend from the fromer used OpenFoodFacts\Document - so no breaking interfaces.

The Document Class now also has a function "getData()" which returns the array representation of the Document.
As the OFF-API returns a randomly ordered JSON on each call, the function also recursively sorts the data by key and string.

Updated README for better usage.