PHP code example of smart-dato / arco-spedizioni-sdk
1. Go to this page and download the library: Download smart-dato/arco-spedizioni-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/ */
smart-dato / arco-spedizioni-sdk example snippets
use SmartDato\ArcoSpedizioni\Facades\ArcoSpedizioni;
$waybillNumber = ArcoSpedizioni::nextWaybillNumber();
use SmartDato\ArcoSpedizioni\ArcoSpedizioni;
$arco = new ArcoSpedizioni(username: 'your-username', password: 'your-password');
use SmartDato\ArcoSpedizioni\Data\AddressData;
use SmartDato\ArcoSpedizioni\Data\ShipmentData;
$routing = ArcoSpedizioni::routing(new ShipmentData(
recipient: new AddressData(
name: 'Mario Rossi',
street: 'Via Roma 1',
city: 'Milano',
zip: '20121',
province: 'MI',
),
weight: 12.5,
volume: 0.1,
cashOnDelivery: 0.0,
isAdrGoods: false,
));
use SmartDato\ArcoSpedizioni\Generators\DdtFileGenerator;
$content = (new DdtFileGenerator())
->setField('arco_sender_client_code', '053696')
->setField('sender_company_name', 'ACME')
->setField('recipient_company_name', 'Mario Rossi')
->setField('recipient_zip_code', '20121')
// … the remaining fields of the record
->setField('end_of_record_flag', 'E')
->addRecord()
->content(); // or ->store('/path/to/file.txt')
use SmartDato\ArcoSpedizioni\Parsers\DdtEsitiParser;
$records = (new DdtEsitiParser())->parseFile('/path/to/esiti.txt');
// or a single line
$record = (new DdtEsitiParser())->parseLine($line);