dinja / poste-delivery-business-sdk
Unofficial PHP SDK for Poste Delivery Business Rest API services
Package info
github.com/dinja-srl/poste-delivery-business-sdk
pkg:composer/dinja/poste-delivery-business-sdk
1.0.10
2026-07-24 09:49 UTC
Requires
- php: >=5.4
- ext-json: *
- guzzlehttp/guzzle: ^7.5
Requires (Dev)
- phpunit/phpunit: ^10.0
- squizlabs/php_codesniffer: ^3.7
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
This package is an unofficial simple PHP SDK for Poste Delivery Business Rest API services v.1.8.5.
Installing
Install with composer
composer require dinja/poste-delivery-business-sdk
Features
Waybill Services
- Create Waybill
- Get Nations
Tracking
- Get Shipment Tracking
Digipod
- Digipod Request
- Digipod Download
Usage
Create Waybill
$debug = false; $timestamp = new \DateTime(); $timezone = new \DateTimeZone('Europe/Rome'); $timestamp->setTimezone($timezone); $waybillDataReceiver = new Dinja\PosteDeliveryBusinessSDK\Api\WaybillDataContact(); $waybillDataReceiver->setNameSurname("Mario Rossi")->setContactName("Dinja Srl") ->setAddressId("") ->setAddress("Via Roma 1") ->setZipCode("70044") ->setCity("Polignano a Mare") ->setCountry("ITA1") ->setProvince("BA") ->setCountryName("Italia") ->setPhone("") ->setCellphone("") ->setEmail("info@sellengine.it"); $waybillDataSender = new Dinja\PosteDeliveryBusinessSDK\Api\WaybillDataContact(); $waybillDataSender->setZipCode("70044") ->setStreetNumber("") ->setPhone("") ->setEmail("info@sellengine.it") ->setCity("Polignano a Mare") ->setAddressId("") ->setAddress("Via Leonardo da Vinci 22") ->setProvince("BA") ->setCountry("ITA1") ->setCountryName("Italia") ->setNameSurname("Dinja Srl") ->setNote1("TEST"); $waybillDataServices = new Dinja\PosteDeliveryBusinessSDK\Api\WaybillDataServices(); $dataWrapper = array(); $waybillDataServices->setDataWrapper($dataWrapper); $declaredArr = array(); $waybillDataDeclared = new Dinja\PosteDeliveryBusinessSDK\Api\WaybillDataDeclared(); $waybillDataDeclared->setWeight("1") ->setHeight("1") ->setLength("1") ->setWidth("1"); array_push($declaredArr, $waybillDataDeclared); $waybillData = new Dinja\PosteDeliveryBusinessSDK\Api\WaybillData(); $waybillData->setDeclared($declaredArr) ->setSender($waybillDataSender) ->setServices($waybillDataServices) ->setReceiver($waybillDataReceiver) ->setContent("Vario"); $waybill = new Dinja\PosteDeliveryBusinessSDK\Api\Waybill(); $waybill->setPrintFormat("ZPL") ->setClientReferenceId("1") ->setProduct("APT000901") ->setData($waybillData); $request = new Dinja\PosteDeliveryBusinessSDK\Request\WaybillRequest("poste_api_client_id", "poste_api_secret_id", "poste_api_scope", $debug); $request->setCostCenterCode("poste_api_cost_center_code") ->setShipmentDate($timestamp->format(\DateTime::ISO8601)) ->setWaybill($waybill); $response = $request->call($debug); if ($response->hasError()) { echo $response->getResult()->getErrorCode(); } else { $waybills = $response->getWaybills(); }
Get Nations
$debug = false; $request = new Dinja\PosteDeliveryBusinessSDK\Request\NationsRequest("poste_api_client_id", "poste_api_secret_id", "poste_api_scope", $debug); $response = $request->call($debug); if ($response->hasError()) { echo $response->getResult()->getErrorCode(); } else { $countries = $response->getCountries(); foreach ($countries as $country) { echo $country->getIso4(); } }
Get Shipment Tracking
$shipmentsData = new Dinja\PosteDeliveryBusinessSDK\Api\ShipmentsData(); $shipmentsData->setWaybillNumber($trackingNumber)->setLastTracingState("N"); $request = new Dinja\PosteDeliveryBusinessSDK\Request\TrackingRequest("poste_api_client_id", "poste_api_secret_id", "poste_api_scope", $debug); $request->setShipmentsData($shipmentsData)->setStatusDescription("E")->setCustomerType("DQ"); $response = $request->call($debug); if ($response->hasError()) { echo $response->getCode(); } else { $shipment = $response->getShipment(); }
Digipod Request
$request = new Dinja\PosteDeliveryBusinessSDK\Request\DigipodReqRequest("poste_api_client_id", "poste_api_secret_id", "poste_api_scope", $debug); $request->setBarcode("TEST"); $response = $request->call($debug); if ($response->hasError()) { echo $response->getResult()->getErrorCode(); } else { $result = $response->getResult()->getResult(); }
Digipod Download
$request = new Dinja\PosteDeliveryBusinessSDK\Request\DigipodDownloadRequest("poste_api_client_id", "poste_api_secret_id", "poste_api_scope", $debug); $request->setBarcode("TEST"); $response = $request->call($debug); if ($response->getResult() == "KO") { echo $response->getErrorCode(); } else { $digipodBase64 = $response->getAttached(); }
Credits
License
This project is licensed under the MIT License (MIT). Please see License File for more information.