Coder Social home page Coder Social logo

php-delegate-b2b-dgxml's Introduction

php-delegate-b2b-dgxml

PHP Library for working with Delegate Group B2B XML files (DGXML).

PHPUnit Version

👉 Currently only supports exporting the Article-/Price Catalog to Delegate DGXML format.

Installation

Requirements

  • PHP 8.0+
    • with extension: dom, intl
  • Composer

Setup

Use Composer to add the package as a dependency to your project:

composer require softwarepunt/php-delegate-b2b-dgxml

Usage

Creating a catalog

Using this library, you can build the catalog by simply assigning PHP objects and values. The structure and property names match the XML and documentation. Each property is type-hinted and contains phpdocs based on the official documentation.

📕 To best understand the structure of the catalog, refer to the official documentation (ArticleCatalog DGXML 1.0_EN).

Create a new ProductCatalog and assign items to it, then export it as XML:

<?php

use SoftwarePunt\DGXML\Documents\ProductCatalog;
use SoftwarePunt\DGXML\Models\Supplier;
use SoftwarePunt\DGXML\Models\CatalogItem;

require_once "vendor/autoload.php";

$catalog = new ProductCatalog();

$catalog->Header->Supplier = new Supplier();
$catalog->Header->Supplier->GLN = "9389229119441";
$catalog->Header->Supplier->Name = "Backshop";

$item = new CatalogItem();
$item->Number = 1602;
$item->Name = "Fuldkornsbrød";
$item->Price->Purchase = 1.6;

$catalog->Items[] = $item;

echo $catalog->toXml(); // <?xml ...

Notes

  • All text values are automatically transliterated to ASCII-only. This solves issues in the Delegate import process, but means special characters cannot be properly represented in the catalogs.
  • You must ensure GTIN / GTINOrderUnit item values can be parsed as a 64-bit integer, or the Delegate software will fail to import the catalog!

php-delegate-b2b-dgxml's People

Contributors

roydejong avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.