CommerceML — Open-source PHP library · 1C integration by Arsen GoianCommerceML — Open-source PHP library · 1C integration by Arsen Goian

CommerceML — Open-source PHP library · 1C integration

Arsen Goian

Arsen Goian

Composer package that turns CommerceML 2.10 XML from 1C into typed PHP objects and back, so PHP shops can exchange data with 1C cleanly.
Role: Author
Client: Open source (GitHub / Packagist)
Team: Solo
Period: 2018

Challenge

Many Ukrainian retailers keep products, prices, counterparties and orders in 1C, which exchanges data with websites in CommerceML — a large XML format with deep nesting and Cyrillic tag names. While the 1C integration for the SanaTech medical-supplies store was being built, it became clear that PHP projects tend to hand-parse this XML with fragile array code. The goal was a reusable library that reads and writes the format through clear, typed objects.

Solution

I extracted the exchange logic into a standalone Composer package, arsengoian/commerce-ml, published on Packagist under the Apache-2.0 licence. A parser maps the XML into a tree of node classes — documents, counterparties, representatives, addresses, products, base units, requisite values and commercial information — and an encoder serialises the tree back to CommerceML. Each node has a constructor and a default implementation, and projects can override implementations with their own classes. PHPUnit tests cover parsing and structure, with coverage reports.

Key features

Parses CommerceML 2.10 XML into typed PHP node objects
Encodes the object tree back to CommerceML XML
Documents, counterparties, products, units and requisites
Override default node implementations with custom classes
PHPUnit tests with coverage; PHP 7.1+, Apache-2.0

Outcome

Published on Packagist in November 2018 as arsengoian/commerce-ml

Stack

PHP 7.1, SimpleXML, Composer, Packagist, PHPUnit, PSR-4, CommerceML 2.10
Like this project

Posted Oct 22, 2026

Composer package that turns CommerceML 2.10 XML from 1C into typed PHP objects and back, so PHP shops can exchange data with 1C cleanly.