PHPackages                             smart-dato/post-it-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. smart-dato/post-it-sdk

ActiveLibrary[API Development](/categories/api)

smart-dato/post-it-sdk
======================

Poste Italiane (POST\_IT) shipping API SDK for Laravel — Saloon-based client with typed DTOs.

v0.0.1(1mo ago)018MITPHPPHP ^8.2

Since May 8Pushed 1mo agoCompare

[ Source](https://github.com/smart-dato/post-it-sdk)[ Packagist](https://packagist.org/packages/smart-dato/post-it-sdk)[ Docs](https://github.com/smart-dato/post-it-sdk)[ RSS](/packages/smart-dato-post-it-sdk/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (7)Versions (2)Used By (0)

Poste Italiane SDK for Laravel
==============================

[](#poste-italiane-sdk-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/01b2d45fdd1daa41144911bdc94de5032328d2aca11b2d1705d37c97516767e3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736d6172742d6461746f2f706f73742d69742d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/smart-dato/post-it-sdk)[![GitHub Tests Action Status](https://camo.githubusercontent.com/245397f9e56fb712c1e95eaca899782f618d54627b0c2692ce156b99ecac87f2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f736d6172742d6461746f2f706f73742d69742d73646b2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/smart-dato/post-it-sdk/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/24eaedd0d7277d43944065cb98e55b1a4e8b5ca252e486a2fc28045748b682e0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f736d6172742d6461746f2f706f73742d69742d73646b2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/smart-dato/post-it-sdk/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/1a3414e69b7c09a8034a0ee542d2b29867c68b3d6d19797be61951741bc5beb7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736d6172742d6461746f2f706f73742d69742d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/smart-dato/post-it-sdk)

Saloon-based client for the Poste Italiane (POST\_IT) shipping API.

- OAuth-style session authentication (`POST /user/sessions`) with in-memory token caching
- Waybill creation (`POST /postalandlogistics/parcel/waybill`) — returns label PDF URL
- Shipment tracking (`POST /postalandlogistics/parcel/tracking`) — returns normalised events
- Typed readonly DTOs for every request and response payload
- Mockable end-to-end via Saloon's `MockClient`

Installation
------------

[](#installation)

```
composer require smart-dato/post-it-sdk
```

The service provider is auto-discovered. Optionally publish the config file:

```
php artisan vendor:publish --tag=post-it-sdk-config
```

Configuration
-------------

[](#configuration)

The SDK is **credential-free by default** — it does not read credentials from config or env. Pass them explicitly when constructing `PostIt`. The published config file (`config/post-it-sdk.php`) is provided as a convenience for single-account integrations that want to centralise defaults; multi-tenant applications typically store credentials per `CarrierAccount` row.

```
use SmartDato\PostIt\PostIt;

// Production (uses confirmed PRODUCTION_BASE_URL = https://apiw.gp.posteitaliane.it/gp/internet):
$client = PostIt::production(
    clientId: 'your-client-id',
    clientSecret: 'your-client-secret',
    scope: 'shipping',
);

// Or, for a custom base URL (test environment, on-premise, alternate contract):
$client = new PostIt(
    baseUrl: 'https://your-tenant.posteitaliane.it/gp/internet',
    clientId: 'your-client-id',
    clientSecret: 'your-client-secret',
    scope: 'shipping',
    grantType: 'client_credentials',
);
```

Creating a waybill
------------------

[](#creating-a-waybill)

```
use SmartDato\PostIt\Constants\PrintFormat;
use SmartDato\PostIt\Data\AddressData;
use SmartDato\PostIt\Data\DeclarationData;
use SmartDato\PostIt\Data\ServicesData;
use SmartDato\PostIt\Data\WaybillData;
use SmartDato\PostIt\Data\WaybillRequestData;
use SmartDato\PostIt\Enums\PaymentModeEnum;

$response = $client->createWaybill(new WaybillRequestData(
    costCenterCode: 'CC100',
    shipmentDate: new DateTimeImmutable(),
    waybills: [
        new WaybillData(
            clientReferenceId: 'ORDER-123',
            printFormat: PrintFormat::DEFAULT,        // '1011' — 10×11 cm
            product: 'POSTACELERE',
            sender: new AddressData(
                nameSurname: 'Sender Co',
                contactName: 'Mario Rossi',
                address: 'Via Roma',
                streetNumber: '1',
                zipCode: '00100',
                city: 'Roma',
                cellphone: '393331111111',
                phone: '393331111111',
            ),
            receiver: new AddressData(
                nameSurname: 'Receiver Co',
                contactName: 'Luigi Bianchi',
                address: 'Via Milano',
                streetNumber: '2',
                zipCode: '20100',
                city: 'Milano',
                cellphone: '393332222222',
                phone: '393332222222',
            ),
            declared: [
                new DeclarationData(weightGrams: 1500, heightCm: 20, lengthCm: 30, widthCm: 40),
            ],
            services: new ServicesData(
                multicolloCode: 'APT000901',
                codAmount: 50.0,
                codPaymentMode: PaymentModeEnum::CashOnDelivery,
            ),
        ),
    ],
));

$waybillNumber = $response->waybills[0]['code'];
$labelPdfUrl = $response->waybills[0]['downloadURL'];
```

`PostItApiException` is thrown when the upstream returns `result.errorCode !== 0` or when the response is missing required fields.

Tracking a shipment
-------------------

[](#tracking-a-shipment)

```
$tracking = $client->trackShipment($waybillNumber);

foreach ($tracking->events as $event) {
    echo $event->statusCode.' '.$event->statusDescription.' @ '.$event->location.PHP_EOL;
}
```

Pass `fullHistory: false` to receive only the latest tracing state instead of the entire history.

Print formats
-------------

[](#print-formats)

`printFormat` is a free-form string because Poste Italiane accepts contract-specific values:

```
use SmartDato\PostIt\Constants\PrintFormat;

PrintFormat::A4;          // 'A4'
PrintFormat::FORMAT_1011; // '1011'  (10×11 cm — default)
PrintFormat::ZPL;         // 'ZPL'
PrintFormat::DEFAULT;     // alias of FORMAT_1011
```

If your account uses a different value, pass it as a raw string.

Testing
-------

[](#testing)

The SDK tests itself with Saloon's `MockClient`. Consumer applications can do the same:

```
use Saloon\Http\Faking\MockClient;
use Saloon\Http\Faking\MockResponse;
use SmartDato\PostIt\Requests\AuthRequest;
use SmartDato\PostIt\Requests\CreateWaybillRequest;

MockClient::global([
    AuthRequest::class => MockResponse::make(['access_token' => 'fake'], 200),
    CreateWaybillRequest::class => MockResponse::make([
        'costCenterCode' => 'CC',
        'contractCode' => 'CT',
        'waybills' => [['code' => 'WB1', 'downloadURL' => 'https://...']],
    ], 200),
]);

// ... your code that calls $client->createWaybill(...) ...

MockClient::destroyGlobal();
```

Quality gate
------------

[](#quality-gate)

```
composer test           # pint + phpstan + pest
composer test:lint      # pint --test
composer test:types     # phpstan analyse
composer test:unit      # pest
composer lint           # pint (fix)
```

License
-------

[](#license)

MIT — see `LICENSE.md`.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance94

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

32d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c3006db55caec62526937fa2d941da32fc5e69e2ca86a52e87c8046da5958d82?d=identicon)[smart-dato](/maintainers/smart-dato)

---

Top Contributors

[![Xsaven](https://avatars.githubusercontent.com/u/1726771?v=4)](https://github.com/Xsaven "Xsaven (1 commits)")

---

Tags

laravelsaloonshippingsmart-datopost-itposte-italiane

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/smart-dato-post-it-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/smart-dato-post-it-sdk/health.svg)](https://phpackages.com/packages/smart-dato-post-it-sdk)
```

###  Alternatives

[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k9.9M87](/packages/dedoc-scramble)[codebar-ag/laravel-docuware

DocuWare integration with Laravel

1122.7k](/packages/codebar-ag-laravel-docuware)[codebar-ag/laravel-zammad

Zammad integration with Laravel

116.7k](/packages/codebar-ag-laravel-zammad)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3913.7k](/packages/rawilk-profile-filament-plugin)[lettermint/lettermint-laravel

Official Lettermint driver for Laravel

1152.3k1](/packages/lettermint-lettermint-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
