1. Go to this page and download the library: Download mikywow/gls_api 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/ */
mikywow / gls_api example snippets
$ClientNumber = 123456789; // Unique client number provided by GLS company.
$connection = new GLS\Connection('[email protected]','password', GLS\Country::CZECHIA);
/** @var GLS\Parcel[] */
$parcels = [];
$pickupAddress = new GLS\Address;
$pickupAddress->Name = 'Company name';
$pickupAddress->Street = 'Nunn Street';
$pickupAddress->HouseNumber = '123';
$pickupAddress->HouseNumberInfo = '88B';
$pickupAddress->City = 'Lyki Valley';
$pickupAddress->ZipCode = '12345';
$pickupAddress->CountryIsoCode = 'CZ';
$pickupAddress->ContactName = 'Jareth Mcarthur';
$pickupAddress->ContactPhone = '123456789';
$pickupAddress->ContactEmail = '[email protected]';
$deliveryAddress = new GLS\Address;
$deliveryAddress->Name = 'Jeffery Fox';
$deliveryAddress->Street = 'Winston Road';
$deliveryAddress->HouseNumber = '256';
$deliveryAddress->HouseNumberInfo = '1';
$deliveryAddress->City = 'Meststoke River';
$deliveryAddress->ZipCode = '43210';
$deliveryAddress->CountryIsoCode = 'CZ';
$deliveryAddress->ContactName = 'Jeffery Fox';
$deliveryAddress->ContactPhone = '123456789';
$deliveryAddress->ContactEmail = '[email protected]';
$variableSymbol = '1234567890';
$parcel = new GLS\Parcel($ClientNumber,$pickupAddress,$deliveryAddress);
$parcel->addCOD(2000,$variableSymbol);
$parcel->setPickupDate(new DateTime());
$parcel->Count = 1;
$parcel->ClientReference = $variableSymbol; // custom ID for identification. Important for error handling more parcels at once
$parcel->Content = 'Custom text on ticket';
$parcels[] = $parcel;