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);

use SmartDato\ArcoSpedizioni\LabelBuilder;

$data = [
    'barcode' => 'data:image/png;base64,…',
    'client' => 'CLIENT',
    'waybill' => '2025xxx000000010000001MZ1',
    'route' => 'LB / MZ / MONZA',
    'gate' => '002',
    'details' => 'xxX/00000001/1',
    'reference' => '123456789',
    'receiver' => 'Mario Rossi',
    'receiverStreet' => 'Via Roma 1',
    'receiverAddress' => '20121 - Milano - MI',
    'shipper' => 'ACME',
    'date' => '01/01/26',
    'weight' => '12,5',
    'volume' => '0,10',
    'parcelNumber' => '1',
    'totalParcels' => '1',
];

$pdf = (new LabelBuilder())->pdf($data);  // PDF bytes, 10 × 9.5 cm
$zpl = (new LabelBuilder())->zpl($data);  // ZPL string
bash
php artisan vendor:publish --tag="arco-spedizioni-sdk-config"