koriym/data-file

Load XML file with XSD validation

1.0.0 2021-06-13 03:47 UTC

This package is auto-updated.

Last update: 2024-03-31 02:07:24 UTC


README

Continuous Integration

Validate and load the XML file.

Installation

composer require koriym/data-file

Usage

Simple XML load with validation

use Koriym\DataFile\XmlLoad;

$xml = (new XmlLoad())('/path/to/xml', '/path/to/xsd');
assert($xml instanceof SimpleXMLElement);

Config xml load

use Koriym\DataFile\XmlConfigLoad;

$xml = (new XmlConfigLoad('confilg.xml'))('/path/to/config_dir', '/path/to/xsd');
assert($xml instanceof SimpleXMLElement);

Loads the config.xml or config.xml.dist of the specified directory. config.xml will be loaded first.

It is common to ignore dist files to save them in the repository and not to save the local files.