PHP code example of webit / comarch-edi-order

1. Go to this page and download the library: Download webit/comarch-edi-order 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/ */

    

webit / comarch-edi-order example snippets



use Doctrine\Common\Annotations\AnnotationRegistry;

// Configure the AnnotationRegistry
$autoload = \EDI\Order\Parser\XmlParserBuilder();
$xmlParserBuilder->setCacheDir(sys_get_temp_dir()); // recommended to set the cache dir for the inner Serializer

/** @var \Webit\Comarch\EDI\Order\Parser\XmlParser $xmlParser */
$xmlParser = $xmlParserBuilder->build();

$myOrder = file_get_contents('my-edi-order.xml');

/** @var \Webit\Comarch\EDI\Order\DocumentOrder $documentOrder */
$documentOrder = $xmlParser->parse($myOrder);




/** @var \Webit\Comarch\EDI\Order\Parser\XmlParser $xmlParser */

$xmlFileParser = new \Webit\Comarch\EDI\Order\Parser\XmlFileParser($xmlParser);
$documentOrder = $xmlFileParser->parse(new \SplFileInfo('my-edi-order.xml'));