PHP code example of ongoing / swissrets-sdk

1. Go to this page and download the library: Download ongoing/swissrets-sdk 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/ */

    

ongoing / swissrets-sdk example snippets


use Ongoing\Swissrets\Dto\SwissRetsExportDto;
use Ongoing\Swissrets\Validator\SwissRetsValidator;

$exportDto = new SwissRetsExportDto(
    generatorName   : 'Test Export',
    generatorVersion: '1.0'
);

/*
 * Create and add propertyDtos to $exportDto
 */

// Validate DTO
SwissRetsValidator::validateExportDto($exportDto);

// Generate JSON
$json = $exportDto->generateJson();

// Generate XML
$xml = $exportDto->generateXml();