darkdarin/xsd-entity-generator

Generator for make DTO from XSD

v1.0.0 2024-02-01 14:30 UTC

This package is auto-updated.

Last update: 2024-11-30 16:15:36 UTC


README

Generator for make DTO from XSD

Install

composer require darkdarin/xsd-entity-generator

Usage

use DarkDarin\XsdEntityGenerator\SchemaLoader;
use DarkDarin\XsdEntityGenerator\Serializer\SchemaSerializerFactory;
use DarkDarin\XsdEntityGenerator\DTOGenerator;
use DarkDarin\XsdEntityGenerator\PrimitiveTypeResolver;

$schemaSerializer = (new SchemaSerializerFactory())();
$schemaLoader = new SchemaLoader($schemaSerializer);
$schema = $schemaLoader->load('path/to/schema.xsd');

$dtoGenerator = new DTOGenerator(new PrimitiveTypeResolver());
$dtoGenerator->generate($schema, 'path/to/generated/classes', '\\Namespace\\For\\Generated\\Classes');