PHPackages                             sashalenz/delivery-auto-api - 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. sashalenz/delivery-auto-api

ActiveLibrary[API Development](/categories/api)

sashalenz/delivery-auto-api
===========================

Delivery Auto API client for Laravel

2.0.3(2w ago)1233MITPHPPHP ^8.2CI failing

Since Mar 21Pushed 2w ago1 watchersCompare

[ Source](https://github.com/sashalenz/delivery-auto-api)[ Packagist](https://packagist.org/packages/sashalenz/delivery-auto-api)[ Docs](https://github.com/sashalenz/delivery-auto-api)[ RSS](/packages/sashalenz-delivery-auto-api/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (5)Dependencies (26)Versions (6)Used By (0)

Delivery-Auto API
=================

[](#delivery-auto-api)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5bf9346954b7472bbde1b6537553aedb64db473ec7f700f95133f065aeabde09/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73617368616c656e7a2f64656c69766572792d6175746f2d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sashalenz/delivery-auto-api)[![Total Downloads](https://camo.githubusercontent.com/dc790b0d51a76ad63569a5d89a1000cfa742db501afa985b58fae12a1bf90a95/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73617368616c656e7a2f64656c69766572792d6175746f2d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sashalenz/delivery-auto-api)

PHP/Laravel client for [Delivery-Auto](https://www.delivery-auto.com/) API v3.5.1 — references, tracking, calculator, receipt issuance, cabinet, and operation logs. Implements **all 38 documented endpoints**, with typed `spatie/laravel-data` request/response DTOs and Laravel-native HTTP retry/caching.

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11, 12, or 13
- `spatie/laravel-data ^4.4`

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

[](#installation)

```
composer require sashalenz/delivery-auto-api
```

Publish the config:

```
php artisan vendor:publish --provider="Sashalenz\DeliveryAuto\DeliveryAutoServiceProvider" --tag="delivery-auto-api-config"
```

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

[](#configuration)

```
// config/delivery-api.php
return [
    'url' => env('DELIVERY_API_URL', 'https://www.delivery-auto.com/api/v4/Public/'),

    // HMAC API keys — issued per company by Delivery-Auto, used for §6 (receipt) endpoints
    'public_key' => env('DELIVERY_API_PUBLIC_KEY'),
    'secret_key' => env('DELIVERY_API_SECRET_KEY'),

    // OPTIONAL — only for §5 (cabinet) and §7 (logs) endpoints, which require username/password
    'username' => env('DELIVERY_API_USERNAME'),
    'password' => env('DELIVERY_API_PASSWORD'),

    'shared_forms_url' => env('DELIVERY_API_SHARED_FORMS_URL', 'https://www.delivery-auto.com/'),
];
```

`.env`:

```
DELIVERY_API_PUBLIC_KEY=your-public-key
DELIVERY_API_SECRET_KEY=your-secret-key
```

### Two auth mechanisms

[](#two-auth-mechanisms)

Delivery-Auto v4 ships with **two distinct auth flows**:

- **HMAC API key** (PDF §6.1) — used by all §6 receipt-issuance endpoints. Header `HMACAuthorization: amx {publicKey}:{timestamp}:{HmacSHA256}`. Algorithm is **SHA-256**, not SHA-1 (this was an upstream documentation gap that the pre-2.0 release of this package got wrong).
- **Login session** — used by §5 personal-cabinet and §7 log endpoints. Username/password via `PostLogin` returns a session cookie that subsequent calls reuse via Laravel's HTTP client cookie jar.

Public reference, tracking, calculation, and communication endpoints (§1–4) need no auth.

### Multi-sender (multiple HMAC keypairs)

[](#multi-sender-multiple-hmac-keypairs)

If your app holds **several Delivery-Auto company keypairs** (one per sender / counterparty), pass them per call instead of relying on the global config:

```
use Sashalenz\DeliveryAuto\DeliveryAuto;

// Per-call factory
DeliveryAuto::receipt(
    publicKey: $sender->public_key,
    secretKey: $sender->secret_key,
)->postCreateReceipts($request);

// Or fluent — handy when you've already obtained a builder
DeliveryAuto::receipt()
    ->withCredentials($sender->public_key, $sender->secret_key)
    ->cache(300)
    ->getSenderList(new GetSenderListRequest);
```

Without overrides the builder falls back to `config('delivery-auto-api.public_key')` / `secret_key`. Cache keys include a hash of the public key, so two senders never share cached responses.

`DeliveryAuto::tracking(...)` accepts the same overrides for `getStickers` (the only HMAC method in that module).

Quick start — round-trip
------------------------

[](#quick-start--round-trip)

```
use Sashalenz\DeliveryAuto\Delivery;
use Sashalenz\DeliveryAuto\ApiModels\Reference\RequestData\GetRegionListRequest;
use Sashalenz\DeliveryAuto\ApiModels\Tracking\RequestData\GetReceiptDetailsRequest;
use Sashalenz\DeliveryAuto\ApiModels\Calculation\RequestData\PostReceiptCalculateRequest;
use Sashalenz\DeliveryAuto\ApiModels\Calculation\RequestData\CategoryRequest;
use Sashalenz\DeliveryAuto\ApiModels\Receipt\RequestData\PostCreateReceiptsRequest;
use Sashalenz\DeliveryAuto\ApiModels\Receipt\RequestData\RegistrationReceiptRequest;
use Sashalenz\DeliveryAuto\Enums\Country;
use Sashalenz\DeliveryAuto\Enums\DeliveryScheme;
use Spatie\LaravelData\DataCollection;

// 1) Lookup — cached for an hour because regions rarely change
$regions = DeliveryAuto::reference()
    ->cache(3600)
    ->getRegionList(new GetRegionListRequest(country: Country::UA));

// 2) Calculate cost
$calc = DeliveryAuto::calculation()->postReceiptCalculate(new PostReceiptCalculateRequest(
    areasSendId:        '4fc948a7-3729-e311-8b0d-00155d037960',
    areasResiveId:      'e3ac6f68-3529-e311-8b0d-00155d037960',
    warehouseSendId:    '1c828aa6-70c8-e211-9902-00155d037919',
    warehouseResiveId:  'd908c5e1-b36b-e211-81e9-00155d012a15',
    InsuranceValue:     1000000,
    CashOnDeliveryValue: 5000,
    dateSend:           new DateTime('+2 days'),
    deliveryScheme:     DeliveryScheme::WarehouseDoor,
    category: new DataCollection(CategoryRequest::class, [[
        'categoryId' => '00000000-0000-0000-0000-000000000000',
        'countPlace' => 1, 'helf' => 1, 'size' => 1,
    ]]),
));
echo $calc->allSumma; // total cost

// 3) Issue a TTN
$created = DeliveryAuto::receipt()->postCreateReceipts(new PostCreateReceiptsRequest(
    receiptsList: new DataCollection(RegistrationReceiptRequest::class, [
        new RegistrationReceiptRequest(
            areasSendId:        '4fc948a7-3729-e311-8b0d-00155d037960',
            areasResiveId:      'e3ac6f68-3529-e311-8b0d-00155d037960',
            dateSend:           new DateTime('+2 days'),
            category: new DataCollection(CategoryRequest::class, [[
                'categoryId' => '00000000-0000-0000-0000-000000000000',
                'countPlace' => 1, 'helf' => 1, 'size' => 1,
            ]]),
            deliveryScheme:     DeliveryScheme::WarehouseWarehouse,
            warehouseSendId:    '1c828aa6-70c8-e211-9902-00155d037919',
            warehouseResiveId:  'd908c5e1-b36b-e211-81e9-00155d012a15',
            receiverName:       'Іванков Іван Іванович',
            receiverPhone:      '0500000000',
        ),
    ]),
));
$ttnNumber = $created[0]->Number;

// 4) Track
$details = DeliveryAuto::tracking()->getReceiptDetails(
    new GetReceiptDetailsRequest(number: $ttnNumber)
);
echo $details->Status->label(); // "Зарезервована" if just created
```

Modules
-------

[](#modules)

The seven module facades on `DeliveryAuto::*` mirror the seven sections of the PDF spec:

FacadePDF sectionAuthPurpose`DeliveryAuto::reference()`§1 ПредставництваnoneRegion/city/warehouse directories`DeliveryAuto::tracking()`§2 Квитанціїnone (HMAC for `getStickers`)TTN status, ETA, sticker metadata`DeliveryAuto::calculation()`§3 РозрахунокnoneTariff lookup, calculator, insurance cost`DeliveryAuto::communication()`§4 Зв'язок із користувачемnoneNews, message themes, service rating, pickup vehicle order`DeliveryAuto::cabinet()`§5, §6.14login sessionUser info, my receipts, pickup orders, deactivate reserved TTNs, full receipt info`DeliveryAuto::receipt()`§6 ОформленняHMACCards/invoices/senders, create TTN, deactivate cargo units, PDF docs, address/client creation`DeliveryAuto::logs()`§7login sessionReceipt operation logs### Reference

[](#reference)

MethodPDFReturns`getRegionList`§1.1`DataCollection``getAreasList` (supports `cityName` autocomplete)§1.2`DataCollection``getWarehousesList`§1.3`DataCollection``getWarehousesInfo`§1.4`WarehouseInfoData?``getWarehousesListByCity`§1.5`DataCollection``getFindWarehouses` (lat/lng + radius)§1.6`DataCollection``getWarehousesListInDetail`§1.7`DataCollection`### Tracking

[](#tracking)

MethodPDFReturns`getReceiptDetails`§2.1`ReceiptData?` (status int → enum)`getDateArrival`§2.2`DateArrivalData?``getStickers` (HMAC)§6.16`DataCollection`### Calculation

[](#calculation)

MethodPDFReturns`getDopUslugiClassification`§3.2`DataCollection``getTariffCategory`§3.3`DataCollection``getCargoCategory` (was wrongly auth-only pre-2.0)§3.4`DataCollection``getDeliveryScheme`§3.5`DataCollection``postReceiptCalculate`§3.6`CalculationData?``getInsuranceCost`§3.7`InsuranceCostData?`### Communication

[](#communication)

MethodPDFReturns`getNews` (paginated)§4.2`DataCollection``getMessagesTheme`§4.3`DataCollection``postServiceRate`§4.4`bool``postPickUpCargo`§4.5`bool`### Cabinet (login-auth)

[](#cabinet-login-auth)

```
// Either pass credentials each time …
DeliveryAuto::cabinet()->postLogin(new PostLoginRequest(
    UserName: 'me@example.com', Password: 'secret'
));

// … or set DELIVERY_API_USERNAME / DELIVERY_API_PASSWORD env vars and call:
DeliveryAuto::cabinet()->loginFromConfig();
```

MethodPDFReturns`postLogin`§5.1`bool` (cookie persists in `SessionStore`)`postLogoff`§5.2`bool` (clears session)`getUserInfo`§5.3`UserInfoData?``getUserReceipt`§5.4`DataCollection``getUserPickUp`§5.5`DataCollection``postDeactivateReceipts` (cancel reserved TTNs)§5.6`bool``getFullReceiptInformation`§6.14`FullReceiptInformationData?`⚠️ The session is process-local. Multi-tenant web apps should call `postLogin` per request with the right credentials, not rely on `loginFromConfig`.

### Receipt (HMAC-auth)

[](#receipt-hmac-auth)

MethodPDFReturns`getClientCards`§6.2`DataCollection``getClientInvoices`§6.3`DataCollection``postCreateReceipts`§6.4`DataCollection``postDeactivateEg`§6.5`bool``getPdfDocument` (base64-decoded PDF)§6.6`PdfDocumentData?``getSenderList`§6.7`DataCollection``getCurrency`§6.8`DataCollection``getAvailableServices`§6.9`AvailableServicesData?``getPayer`§6.10`DataCollection``getClientAddress`§6.11`DataCollection``getPosibleReciver`§6.12`DataCollection``getClientPaymentType`§6.13`bool` (cash vs cashless)`postCreateAddressOrClient`§6.15`CreatedAddressOrClientData?``postAddReceiptIntoPickUpRequest`§6.17`bool`### Logs (login-auth)

[](#logs-login-auth)

MethodPDFReturns`getUnidersalLogsByReceiptNumber` (sic — vendor typo)§7.1`DataCollection`### SendingRegister URL builder

[](#sendingregister-url-builder)

§6.18 returns HTML, not JSON, so we expose only a URL builder (no HTTP call):

```
use Sashalenz\DeliveryAuto\SendingRegisterUrlBuilder;
use Sashalenz\DeliveryAuto\Enums\Culture;

$url = SendingRegisterUrlBuilder::url(
    id: '00123456',
    type: SendingRegisterUrlBuilder::FORM_TYPE_DETAILED,
    culture: Culture::UkUA,
);
// https://www.delivery-auto.com/uk-UA/SharedForms/SendingRegister?id=00123456&type=0
```

Caching
-------

[](#caching)

Every module method supports `->cache($seconds)`. `seconds = -1` (default) means cache forever:

```
$regions = DeliveryAuto::reference()->cache(3600)->getRegionList(...);
$schemes = DeliveryAuto::calculation()->cache(86400)->getDeliveryScheme(...);
```

Cache keys are derived from `(method, GET/POST, authMode, base64(serialize(params)))` — same params hit the same entry.

⚠️ Don't cache user-scoped (cabinet/logs) calls — the session cookie is implicit, but params alone don't differentiate users.

Enums cheat-sheet
-----------------

[](#enums-cheat-sheet)

EnumTypeValues`Currency`int`UAH = 100000000` (PDF §8.2)`Country`int`UA = 1``Culture`string`UkUA`, `EnUS``ReceiptStatus`int14 states (0..13), with `isFinal()`/`isSuccess()`/`isInTransit()``ReceiptType`int10 types (PDF §8.4)`OrderState`int4 states (PDF §8.5), with `isOpen()`/`isCancelled()``OperationCode`intLog operation codes (PDF §8.3)`DeliveryScheme`int`WarehouseWarehouse=0`, `DoorDoor=1`, `WarehouseDoor=2`, `DoorWarehouse=3`, with `requiresPickupAddress()`/etc.`WarehouseType`int`Standard=0`, `CashTransferEnabled=3``DocumentType`int`Receipt=0`, `StickersPerPage=1`, `StickersOneSheet=2`, `MultiReceipt95x95=4``PayerType`int`Sender=0`, `Receiver=1`, `ThirdParty=2``PaymentType`int`Cash=0`, `Cashless=1``CashOnDeliveryType`int`Card=0`, `Invoice=1`, `Cash=2``DirectionType`int`Send=0`, `Receive=1``ReceiptListType`int`Outgoing=0`, `Incoming=1`Use the enum in DTO requests directly: `new GetRegionListRequest(country: Country::UA)`. In responses, `EnumCast` parses raw API integers into typed enum cases — match on them, never on raw strings.

Error handling
--------------

[](#error-handling)

```
use Sashalenz\DeliveryAuto\Exceptions\DeliveryAutoException;
use Sashalenz\DeliveryAuto\Exceptions\DeliveryAutoApiUnavailableException;

try {
    $result = DeliveryAuto::receipt()->postCreateReceipts($request);
} catch (DeliveryAutoApiUnavailableException $e) {
    // Catch FIRST — vendor is down (5xx, ConnectionException, DNS, timeout).
    // Retry with backoff; route to monitoring as warning, not error.
    Log::warning('delivery-auto unavailable', ['exception' => $e]);
    throw $e; // or queue and retry
} catch (DeliveryAutoException $e) {
    // 4xx, application-level `status: false`. Real bug or invalid input.
    Log::error('delivery-auto request failed', ['exception' => $e]);
    throw $e;
}
```

ExceptionTriggered bySeverity`DeliveryAutoApiUnavailableException``ConnectionException`, 5xx responsewarning (transient infra)`DeliveryAutoException`4xx response, `status: false` payloaderror (application bug or bad input)The HTTP layer auto-retries 3× with 100ms backoff before exceptions surface. Both exceptions wrap the original via `previous: $e` so root cause survives in logs.

### Bugsnag routing snippet

[](#bugsnag-routing-snippet)

```
// app/Exceptions/Handler.php (or via Bugsnag::registerCallback)
Bugsnag::registerCallback(function (Bugsnag\Report $report) {
    if ($report->getOriginalError() instanceof DeliveryAutoApiUnavailableException) {
        $report->setSeverity('warning');
    }
});
```

Print labels &amp; stickers
---------------------------

[](#print-labels--stickers)

```
use Sashalenz\DeliveryAuto\ApiModels\Receipt\RequestData\GetPdfDocumentRequest;
use Sashalenz\DeliveryAuto\Enums\DocumentType;

// Returns base64-encoded PDF — `binary()` decodes to raw bytes.
$pdf = DeliveryAuto::receipt()->getPdfDocument(new GetPdfDocumentRequest(
    number: ['9900112233', '9900223344'],
    type:   DocumentType::StickersOneSheet,
));

return response($pdf->binary(), 200, ['Content-Type' => 'application/pdf']);
```

For sticker JSON metadata (without the PDF render), use `DeliveryAuto::tracking()->getStickers(...)`.

Testing
-------

[](#testing)

```
composer test           # run pest
composer test-coverage  # with coverage
composer analyse        # phpstan level 6
composer format-test    # pint
```

Changelog
---------

[](#changelog)

See [CHANGELOG.md](CHANGELOG.md). The 2.0 release is a breaking rewrite — see [UPGRADING.md](UPGRADING.md) for migration notes from 1.x.

Security
--------

[](#security)

If you discover a security vulnerability, please email  instead of opening a public issue.

Credits
-------

[](#credits)

- [Oleksandr Petrovskyi](https://github.com/sashalenz)
- All Contributors

License
-------

[](#license)

MIT — see [LICENSE.md](LICENSE.md).

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance96

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

 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

Every ~295 days

Total

5

Last Release

19d ago

Major Versions

0.3.0 → 2.0.02026-05-08

PHP version history (2 changes)0.3.0PHP ^8.1

2.0.0PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13202688?v=4)[Oleksandr Petrovskyi](/maintainers/sashalenz)[@sashalenz](https://github.com/sashalenz)

---

Top Contributors

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

---

Tags

laraveldeliverysashalenzdelivery-auto-api

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/sashalenz-delivery-auto-api/health.svg)

```
[![Health](https://phpackages.com/badges/sashalenz-delivery-auto-api/health.svg)](https://phpackages.com/packages/sashalenz-delivery-auto-api)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

816333.8k3](/packages/defstudio-telegraph)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M132](/packages/laravel-pulse)[api-platform/laravel

API Platform support for Laravel

58171.5k14](/packages/api-platform-laravel)[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k9.0M69](/packages/spatie-laravel-responsecache)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5021.9k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

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