Is there a development based on laminas/serializer that can convert complex object structures into corresponding XML and back? Perhaps similar to what you might know from various C# or .NET implementations. Here is a small code example to illustrate this.
<?php
declare(strict_types=1);
namespace Marcel\Dto;
use Marcel\Serializer\Xml\Attribute;
final class SomeDto implements \Serializable
{
public function __construct(
#[Attribute\Attribute(name: 'XmlAttribute', type: 'SomeXmlType')]
protected readonly string $attribute,
#[Attribute\Element(name: 'XmlElement', type: 'SomeXmlType', namespace: '...']
protected readonly string $element,
) {}
public function serialize(): ?string
{
// some serializer serializes this object into proper xml
}
}
Is something like that already available or do I have to code it for myself?
PS: I know, that there is some kind of outdated XmlSerializer
class in PEAR. It feels kinda unconfy using PEAR extensions these days. I would gladly do without it.
Thanks for your advices in advance!