mpi2/xmldatatype

Mapping of XML datatypes to PHP Classes with validation

dev-master 2014-05-19 11:33 UTC

This package is not auto-updated.

Last update: 2025-05-06 10:43:59 UTC


README

This package is a bunch of PHP classes that map primitive XML data types and a few other ones. The classes have some built-in validation checking so they throw an Exception if you try to assign the wrong value type.

The best way to get started using this package is to install Composer and find the package on Packagist to add it as a dependency.

Example of basic usage:

<?php

require_once 'vendor/autoload.php';

$num = new XMLDatatype\Integer(99);

echo "Ich habe $num luftballons";
#Output: Ich habe 99 luftballons

All the classes allow you to use these methods:

  • getName()
  • getValue()
  • setValue($value)
  • toString()

And some have methods specific to the datatype. Feel free to explore the source code in ./src. If you want to add more data types or fix bugs then you are more than welcome to contribute.