PHP code example of darkdarin / xsd-entity-generator

1. Go to this page and download the library: Download darkdarin/xsd-entity-generator 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/ */

    

darkdarin / xsd-entity-generator example snippets


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');