PHP code example of janmuran / qdl-sdk

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

    

janmuran / qdl-sdk example snippets


return [
    'login' => env('QDL_API_LOGIN'),
    'password' => env('QDL_API_PASSWORD'),
    'url' => env('QDL_API_URL'),
];

$this->app->when(Config::class)
      ->needs('$login')->give(config('qdl.login'));
$this->app->when(Config::class)
       ->needs('$password')->give(config('qdl.password'));
$this->app->when(Config::class)
       ->needs('$url')->give(config('qdl.url'));

$login = '';
$pass = '';
$sender = 1;

Config($login, $pass, 'https://qdl.sk');
$client = new Janmuran\QdlSdk\Client\Client($config);
$serializer =  JMS\Serializer\SerializerBuilder::create()->build();
$responseBuilder = new Janmuran\ObjectBuilder\ResponseBuilder($serializer);
$qdl = new Janmuran\QdlSdk\Qdl($client, $responseBuilder);

$shipments = new Janmuran\QdlSdk\Model\Shipments();

$date = new DateTimeImmutable();

$shipment = new Janmuran\QdlSdk\Model\Shipment(
    '123456',
    $date->format('d.m.Y'),
    0.0,
    '',
    '',
    'Test note',
    new \Janmuran\QdlSdk\Model\Sender(
        1,
        0,
        'Name Surname',
        'Hlavna 1',
        '84545',
        'Bratislava',
        'SK'
    ),
    new \Janmuran\QdlSdk\Model\Recipient(
        'Jan Muran',
        'Hlavna 1',
        '84545',
        'Bratislava',
        'SK',
        '+421949123456',
        '[email protected]',
        'Name Surname'
    ),
    \Janmuran\QdlSdk\Model\Insurance::createNoInsurance(),
    new \Janmuran\QdlSdk\Model\Services(false, false, true, true, false, '[email protected]'),
    [
        new \Janmuran\QdlSdk\Model\Item(10.0, '1123')
    ]
);

$shipments->addShipment($shipment);

$response = $qdl->sendShipments($shipments);
print_r($response->getShipments());
print_r($response->getShipmentNumbersByRef());