PHP code example of kingson-de / marshal-xml-serializer
1. Go to this page and download the library: Download kingson-de/marshal-xml-serializer library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kingson-de / marshal-xml-serializer example snippets
use KingsonDe\Marshal\AbstractObjectMapper;
use KingsonDe\Marshal\Data\FlexibleData;
use KingsonDe\Marshal\MarshalXml;
class AcmeExampleIdMapper extends AbstractObjectMapper {
public function map(FlexibleData $flexibleData, ...$additionalData) {
return $flexibleData
->get('container')
->get('acme-example:config')
->get('acme-example:id')
->get(MarshalXml::CDATA_KEY);
}
}
use KingsonDe\Marshal\MarshalXml;
$id = MarshalXml::deserializeXml($xml, new AcmeExampleIdMapper());
use KingsonDe\Marshal\MarshalXml;
$id = MarshalXml::deserializeXmlCallable($xml, function (FlexibleData $flexibleData) {
return $flexibleData['container']['acme-example:config']['acme-example:id'][MarshalXml::CDATA_KEY];
});
use KingsonDe\Marshal\Data\FlexibleData;
use KingsonDe\Marshal\MarshalXml;
$xml = '<?xml version="1.0" encoding="UTF-8"
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.