yocto/yoclib-propertylist

This yocLibrary enables your project to encode and decode Property List files in PHP.

v1.0.0 2023-05-27 14:07 UTC

This package is auto-updated.

Last update: 2024-10-27 17:06:20 UTC


README

This yocLibrary enables your project to encode and decode Property List files in PHP.

Status

CI

Installation

composer require yocto/yoclib-propertylist

Use

Serialization

use YOCLIB\PropertyList\PropertyList;

$object = ['string_data',true,false];

$plist = new PropertyList;
$plist->setObject($object);

$xml = $plist->serialize(PropertyList::FORMAT_XML);

Deserialization

use YOCLIB\PropertyList\PropertyList;

$xml = '<plist xlmns="https://www.apple.com/DTDs/PropertyList-1.0.dtd" version="1.0"><array><string>string_data</string><true/><false/></array></plist>';

$plist = new PropertyList;
$plist->deserialize(PropertyList::FORMAT_XML,$xml);

$object = $plist->getObject();

Supported Formats

A Property List comes in one of the following formats:

Note: At the moment, the implementation of the ASCII formats in this library should not be trusted. It doesn't understand comments, and it has some white-space detection hardcoded, so it is possible that it fails on a valid ASCII Property List.