petrocki/iof-xml-php

PHP model classes and XML serialization/deserialization tools for the IOF XML 3.0 data standard

Maintainers

Package info

github.com/petrocki/iof-xml-php

pkg:composer/petrocki/iof-xml-php

Transparency log

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v1.1.0 2026-07-13 19:31 UTC

This package is auto-updated.

Last update: 2026-07-13 19:46:31 UTC


README

Latest Version

PHP model classes and XML serialization/deserialization tools for the IOF XML 3.0 data standard.

Requirements

  • PHP 8.3+

Installation

composer require petrocki/iof-xml-php

Usage

Deserializing (XML → PHP objects)

use IofXmlPhp\Deserializer\IofXmlDeserializer;

$deserializer = new IofXmlDeserializer();
$entryList = $deserializer->deserializeEntryList(file_get_contents('entry-list.xml'));

echo $entryList->getEvent()->getName();

Serializing (PHP objects → XML)

use IofXmlPhp\Serializer\IofXmlSerializer;

$serializer = new IofXmlSerializer();
$xml = $serializer->serializeEntryList($entryList);

Configuring message metadata

  • IOF XML root message elements (for example OrganisationList, EntryList, etc.) contain common metadata fields such as the IOF version, creation time, and creator.
  • The library provides an IofMessageFactory that creates message objects with these metadata fields automatically initialized.
use IofXmlPhp\Factory\IofMessageFactory;

$factory = new IofMessageFactory(creator: 'My Application');
$organisationList = $factory->create(OrganisationList::class);

Development

Docker

Build image:

docker build -t iof-xml-php:current .

Use bash in the container:

docker run -it -v "$(pwd):/var/www/iof-xml-php" iof-xml-php:current bash

Regenerating model classes

The classes in src/Model/ and metadata in src/Metadata/ are auto-generated from resources/IOF.xsd. Do not edit them manually. To regenerate after an XSD change:

vendor/bin/xsd2php convert config/xsd2php.yaml resources/IOF.xsd

Running tests

composer phpunit

Code style

composer cs-check
composer cs-fix

Related