PHPackages                             horstoeko/orderx - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. horstoeko/orderx

ActivePackage[PDF &amp; Document Generation](/categories/documents)

horstoeko/orderx
================

A library for creating and reading Order-X document

v1.0.26(1y ago)770.3k↑56.5%31MITPHPPHP &gt;=7.3CI passing

Since Dec 25Pushed 2mo ago5 watchersCompare

[ Source](https://github.com/horstoeko/orderx)[ Packagist](https://packagist.org/packages/horstoeko/orderx)[ Docs](https://github.com/horstoeko/orderx)[ RSS](/packages/horstoeko-orderx/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (21)Versions (29)Used By (1)

Order-X
=======

[](#order-x)

[![Latest Stable Version](https://camo.githubusercontent.com/5f25e24027356f66db77b0f5b2c8c0bbc25ac23d67a8017e5bc05712e9b95ac0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f686f7273746f656b6f2f6f72646572782e7376673f7374796c653d706c6173746963)](https://packagist.org/packages/horstoeko/orderx)[![PHP version](https://camo.githubusercontent.com/9c55a521d198335de1750c64aa0876bd877bb1ee0416bfcef307e55296a5b509/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f686f7273746f656b6f2f6f72646572782e7376673f7374796c653d706c6173746963)](https://packagist.org/packages/horstoeko/orderx)[![License](https://camo.githubusercontent.com/fe9a8b26cd4d7d23881e21a4561425c2fcef721a20bc602b00adac0deb6dd4b8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f686f7273746f656b6f2f6f72646572782e7376673f7374796c653d706c6173746963)](https://packagist.org/packages/horstoeko/orderx)

[![Build Status](https://github.com/horstoeko/orderx/actions/workflows/build.ci.yml/badge.svg)](https://github.com/horstoeko/orderx/actions/workflows/build.ci.yml)[![Release Status](https://github.com/horstoeko/orderx/actions/workflows/build.release.yml/badge.svg)](https://github.com/horstoeko/orderx/actions/workflows/build.release.yml)

A simple Order-X Library

With `horstoeko/orderx` you can read and write xml files containing electronic orders data in all Profiles.

Information about...

- [OrderX](https://www.ferd-net.de/standards/order-x) (German)

This package makes use of [JMS Serializer](http://jmsyst.com/libs/serializer), [Xsd2Php](https://github.com/goetas-webservices/xsd2php), [FPDF](https://github.com/Setasign/FPDF) and [FPDI](https://github.com/Setasign/FPDI).

Installation
------------

[](#installation)

There is one recommended way to install `horstoeko/orderx` via [Composer](https://getcomposer.org/):

- adding the dependency to your `composer.json` file:

```
  "require": {
      ..
      "horstoeko/orderx":"^1",
      ..
  },
```

Usage
-----

[](#usage)

For detailed eplanation you may have a look in the `examples` of this package and the documentation attached to every release.

### Reading a xml file

[](#reading-a-xml-file)

```
use horstoeko\orderx\OrderDocumentReader;

$document = OrderDocumentReader::readAndGuessFromFile(dirname(__FILE__) . "/order-x.xml");

$document->getDocumentInformation(
    $documentNo,
    $documentTypeCode,
    $documentDate,
    $documentCurrency,
    $documentName,
    $documentLanguageId,
    $documentEffectiveSpecifiedPeriod,
    $documentPurposeCode,
    $documentRequestedResponseTypeCode)

echo "The Order No. is {$documentno}" . PHP_EOL;
```

### Reading a pdf file with xml attachment

[](#reading-a-pdf-file-with-xml-attachment)

```
use horstoeko\orderx\OrderDocumentPdfReader;

$document = OrderDocumentPdfReader::readAndGuessFromFile(dirname(__FILE__) . "/order-x.pdf");

$document->getDocumentInformation(
    $documentNo,
    $documentTypeCode,
    $documentDate,
    $documentCurrency,
    $documentName,
    $documentLanguageId,
    $documentEffectiveSpecifiedPeriod,
    $documentPurposeCode,
    $documentRequestedResponseTypeCode)

echo "The Order No. is {$documentno}" . PHP_EOL;
```

### Writing a xml file

[](#writing-a-xml-file)

```
use horstoeko\orderx\OrderProfiles;
use horstoeko\orderx\OrderDocumentBuilder;

$document = OrderDocumentBuilder::createNew(
    OrderProfiles::PROFILE_EXTENDED
);

$document
    ->setIsDocumentCopy(false)
    ->setIsTestDocument(false)
    ->setDocumentBusinessProcessSpecifiedDocumentContextParameter("A1")

    ->setDocumentInformation("PO123456789", "220", new \DateTime(), "EUR", "Doc Name", null, new \DateTime(), "9", "AC")
    ->addDocumentNote("Content of Note", "AAI", "AAI")
    ->setDocumentBuyerReference("BUYER_REF_BU123")

    ->setDocumentSeller("SELLER_NAME", "SUPPLIER_ID_321654", "SELLER_ADD_LEGAL_INFORMATION")
    ->addDocumentSellerGlobalId("123654879", "0088")
    ->addDocumentSellerTaxRegistration("VA", "FR 32 123 456 789")
    ->addDocumentSellerTaxRegistration("FC", "SELLER_TAX_ID")
    ->setDocumentSellerAddress("SELLER_ADDR_1", "SELLER_ADDR_2", "SELLER_ADDR_3", "75001", "SELLER_CITY", "FR")
    ->setDocumentSellerLegalOrganisation("123456789", "0002", "SELLER_TRADING_NAME")
    ->setDocumentSellerContact("SELLER_CONTACT_NAME", "SELLER_CONTACT_DEP", "+33 6 25 64 98 75", null, "contact@seller.com", "SR")
    ->setDocumentSellerElectronicAddress("EM", "sales@seller.com")

    ->setDocumentBuyer("BUYER_NAME", "BY_ID_9587456")
    ->addDocumentBuyerGlobalId("98765432179", "0088")
    ->addDocumentBuyerTaxRegistration("VA", "FR 05 987 654 321")
    ->setDocumentBuyerAddress("BUYER_ADDR_1", "BUYER_ADDR_2", "BUYER_ADDR_3", "69001", "BUYER_CITY", "FR")
    ->setDocumentBuyerLegalOrganisation("987654321", "0002", "BUYER_TRADING_NAME")
    ->setDocumentBuyerContact("BUYER_CONTACT_NAME", "BUYER_CONTACT_DEP", "+33 6 65 98 75 32", null, "contact@buyer.com", "LB")
    ->setDocumentBuyerElectronicAddress("EM", "operation@buyer.com")

    ->setDocumentBuyerRequisitioner("BUYER_REQ_NAME", "BUYER_REQ_ID_25987")
    ->addDocumentBuyerRequisitionerGlobalId("654987321", "0088")
    ->addDocumentBuyerRequisitionerTaxRegistration("VA", "FR 92 654 987 321")
    ->setDocumentBuyerRequisitionerAddress("BUYER_REQ_ADDR_1", "BUYER_REQ_ADDR_2", "BUYER_REQ_ADDR_3", "69001", "BUYER_REQ_CITY", "FR")
    ->setDocumentBuyerRequisitionerLegalOrganisation("654987321", "0022", "BUYER_REQ_TRADING_NAME")
    ->setDocumentBuyerRequisitionerContact("BUYER_REQ_CONTACT_NAME", "BUYER_REQ_CONTACT_DEP", "+33 6 54 98 65 32", null, "requisitioner@buyer.com", "PD")
    ->setDocumentBuyerRequisitionerElectronicAddress("EM", "purchase@buyer.com")

    ->setDocumentDeliveryTerms("FCA", "Free Carrier", "7", "DEL_TERMS_LOC_ID", "DEL_TERMS_LOC_Name")

    ->setDocumentSellerOrderReferencedDocument("SALES_REF_ID_459875")
    ->setDocumentBuyerOrderReferencedDocument("PO123456789")
    ->setDocumentQuotationReferencedDocument("QUOT_125487")
    ->setDocumentContractReferencedDocument("CONTRACT_2020-25987")
    ->setDocumentRequisitionReferencedDocument("REQ_875498")
    ->addDocumentAdditionalReferencedDocument("916", "ADD_REF_DOC_ID", "ADD_REF_DOC_URIID", "ADD_REF_DOC_Desc")
    ->addDocumentAdditionalReferencedDocument("50", "TENDER_ID")
    ->addDocumentAdditionalReferencedDocument("130", "OBJECT_ID", null, null, "AWV")
    ->setDocumentBlanketOrderReferencedDocument("BLANKET_ORDER_OD", new \DateTime())
    ->setDocumentPreviousOrderChangeReferencedDocument("PREV_ORDER_C_ID", new \DateTime())
    ->setDocumentPreviousOrderResponseReferencedDocument("PREV_ORDER_R_ID", new \DateTime())
    ->setDocumentProcuringProject("PROJECT_ID", "Project Reference")

    ->setDocumentShipTo("SHIP_TO_NAME", "SHIP_TO_ID")
    ->addDocumentShipToGlobalId("5897546912", "0088")
    ->addDocumentShipToTaxRegistration("VA", "FR 66 951 632 874")
    ->setDocumentShipToAddress("SHIP_TO_ADDR_1", "SHIP_TO_ADDR_2", "SHIP_TO_ADDR_3", "69003", "SHIP_TO_CITY", "FR")
    ->setDocumentShipToLegalOrganisation("951632874", "0002", "SHIP_TO_TRADING_NAME")
    ->setDocumentShipToContact("SHIP_TO_CONTACT_NAME", "SHIP_TO_CONTACT_DEP", "+33 6 85 96 32 41", null, "shipto@customer.com", "SD")
    ->setDocumentShipToElectronicAddress("EM", "delivery@buyer.com")

    ->setDocumentShipFrom("SHIP_FROM_NAME", "SHIP_FROM_ID")
    ->addDocumentShipFromGlobalId("875496123", "0088")
    ->addDocumentShipFromTaxRegistration("VA", "FR 16 548 963 127")
    ->setDocumentShipFromAddress("SHIP_FROM_ADDR_1", "SHIP_FROM_ADDR_2", "SHIP_FROM_ADDR_3", "75003", "SHIP_FROM_CITY", "FR")
    ->setDocumentShipFromLegalOrganisation("548963127", "0002", "SHIP_FROM_TRADING_NAME")
    ->setDocumentShipFromContact("SHIP_FROM_CONTACT_NAME", "SHIP_FROM_CONTACT_DEP", "+33 6 85 96 32 41", null, "shipfrom@seller.com", "SD")
    ->setDocumentShipFromElectronicAddress("EM", "warehouse@seller.com")

    ->setDocumentRequestedDeliverySupplyChainEvent(new \DateTime(), new \DateTime(), new \DateTime())

    ->setDocumentInvoicee("INVOICEE_NAME", "INVOICEE_ID_9587456")
    ->addDocumentInvoiceeGlobalId("98765432179", "0088")
    ->addDocumentInvoiceeTaxRegistration("VA", "FR 05 987 654 321")
    ->addDocumentInvoiceeTaxRegistration("FC", "INVOICEE_TAX_ID")
    ->setDocumentInvoiceeAddress("INVOICEE_ADDR_1", "INVOICEE_ADDR_2", "INVOICEE_ADDR_3", "69001", "INVOICEE_CITY", "FR")
    ->setDocumentInvoiceeLegalOrganisation("987654321", "0002", "INVOICEE_TRADING_NAME")
    ->setDocumentInvoiceeContact("INVOICEE_CONTACT_NAME", "INVOICEE_CONTACT_DEP", "+33 6 65 98 75 32", null, "invoicee@buyer.com", "LB")
    ->setDocumentInvoiceeElectronicAddress("EM", "invoicee@buyer.com")

    ->setDocumentPaymentMean("30", "Credit Transfer")
    ->addDocumentPaymentTerm("PAYMENT_TERMS_DESC")
    ->addDocumentAllowanceCharge(31.00, false, "S", "VAT", 20, null, 10.00, 310.00, null, null, "64", "SPECIAL AGREEMENT")
    ->addDocumentAllowanceCharge(21.00, true, "S", "VAT", 20, null, 10.00, 210.00, null, null, "FC", "FREIGHT SERVICES")
    ->setDocumentSummation(310, 360, 21, 31, 300, 60)
    ->setDocumentReceivableSpecifiedTradeAccountingAccount("BUYER_ACCOUNT_REF")

    ->addNewPosition("1")
    ->setDocumentPositionNote("WEEE Tax of 0,50 euros per item included", null, "TXD")
    ->setDocumentPositionProductDetails("Product Name", "Product Description", "987654321", "654987321", "0160", "1234567890123", "Product Batch ID (lot ID)", "Product Brand Name")
    ->addDocumentPositionProductCharacteristic("Characteristic Description", "5 meters", "Characteristic_Code")
    ->addDocumentPositionProductClassification("Class_code", "Name Class Codification", "TST")
    ->setDocumentPositionProductInstance("Product Instances Batch ID", "Product Instances Supplier Serial ID")
    ->setDocumentPositionSupplyChainPackaging("7B", 5, "MTR", 3, "MTR", 1, "MTR")
    ->setDocumentPositionProductOriginTradeCountry("FR")
    ->setDocumentPositionProductReferencedDocument("ADD_REF_PROD_ID", "6", "ADD_REF_PROD_URIID", null, "ADD_REF_PROD_Desc")
    ->setDocumentPositionBuyerOrderReferencedDocument("1")
    ->setDocumentPositionQuotationReferencedDocument("QUOT_125487", "3")
    ->addDocumentPositionAdditionalReferencedDocument("ADD_REF_DOC_ID", "916", "ADD_REF_DOC_URIID", 5, "ADD_REF_DOC_Desc")
    ->addDocumentPositionAdditionalReferencedDocument("OBJECT_125487", "130", null, null, null, "AWV")
    ->setDocumentPositionGrossPrice(10.50, 1, "C62")
    ->addDocumentPositionGrossPriceAllowanceCharge(1.00, false, "DISCOUNT", "95")
    ->addDocumentPositionGrossPriceAllowanceCharge(0.50, true, "WEEE", "AEW")
    ->setDocumentPositionNetPrice(10, 1, "C62")
    ->setDocumentPositionCatalogueReferencedDocument("CATALOG_REF_ID", 2)
    ->setDocumentPositionBlanketOrderReferencedDocument(2)
    ->setDocumentPositionPartialDelivery(true)
    ->setDocumentPositionDeliverReqQuantity(6, "C62")
    ->setDocumentPositionDeliverPackageQuantity(3, "C62")
    ->setDocumentPositionDeliverPerPackageQuantity(2, "C62")
    ->addDocumentPositionRequestedDeliverySupplyChainEvent(null, new \DateTime(), new \DateTime())
    ->addDocumentPositionTax("S", "VAT", 20.0)
    ->addDocumentPositionAllowanceCharge(6.00, false, 10.0, 60.0, "64", "SPECIAL AGREEMENT")
    ->addDocumentPositionAllowanceCharge(6.00, true, 10.0, 60.0, "FC", "FREIGHT SERVICES")
    ->setDocumentPositionLineSummation(60.0)
    ->setDocumentPositionReceivableTradeAccountingAccount("BUYER_ACCOUNTING_REF")

    ->writeFile(getcwd() . "/order-x.xml");
```

### Writing a pdf file with attached xml file

[](#writing-a-pdf-file-with-attached-xml-file)

```
use horstoeko\orderx\OrderProfiles;
use horstoeko\orderx\OrderDocumentBuilder;
use horstoeko\orderx\OrderDocumentPdfBuilder;

$document = OrderDocumentBuilder::createNew(
    OrderProfiles::PROFILE_EXTENDED
);

$document
    ->setIsDocumentCopy(false)
    ->setIsTestDocument(false)
    ->setDocumentBusinessProcessSpecifiedDocumentContextParameter("A1")

    ->setDocumentInformation("PO123456789", "220", new \DateTime(), "EUR", "Doc Name", null, new \DateTime(), "9", "AC");

    // Do some other stuff (see above)

$pdfDocument = new OrderDocumentPdfBuilder(
    $document,
    dirname(__FILE__) . "/../src/assets/empty.pdf"
);

$pdfDocument
    ->generateDocument()
    ->saveDocument(getcwd() . "/order-x.pdf");
```

Note
----

[](#note)

The code in this project is provided under the [MIT](https://opensource.org/licenses/MIT) license.

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance67

Regular maintenance activity

Popularity39

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 57.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~31 days

Recently: every ~68 days

Total

27

Last Release

430d ago

PHP version history (4 changes)v1.0.0PHP ^7.3|^8.0|^8.1

v1.0.8PHP ^7.3|^7.4|^8.0|^8.1

v1.0.18PHP ^7.3|^7.4|^8

v1.0.26PHP &gt;=7.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/24de09032b9a378d782bb7eac3f60914f64967e5a68d51527439dcf7c51711ba?d=identicon)[horstoeko](/maintainers/horstoeko)

---

Top Contributors

[![horstoeko](https://avatars.githubusercontent.com/u/2326713?v=4)](https://github.com/horstoeko "horstoeko (12 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (7 commits)")[![HLeithner](https://avatars.githubusercontent.com/u/1497730?v=4)](https://github.com/HLeithner "HLeithner (1 commits)")[![turbo124](https://avatars.githubusercontent.com/u/5827962?v=4)](https://github.com/turbo124 "turbo124 (1 commits)")

---

Tags

cross-industry-orderorder-xphpphp7php8uncefactelectronicorderorderxorder-x

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/horstoeko-orderx/health.svg)

```
[![Health](https://phpackages.com/badges/horstoeko-orderx/health.svg)](https://phpackages.com/packages/horstoeko-orderx)
```

###  Alternatives

[horstoeko/zugferd

A library for creating and reading european electronic invoices

4174.3M18](/packages/horstoeko-zugferd)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19562.3M1.3k](/packages/drupal-core)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
