Download the PHP package sashalenz/delivery-auto-api without Composer
On this page you can find all versions of the php package sashalenz/delivery-auto-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sashalenz/delivery-auto-api
More information about sashalenz/delivery-auto-api
Files in sashalenz/delivery-auto-api
Package delivery-auto-api
Short Description Delivery Auto API client for Laravel
License MIT
Homepage https://github.com/sashalenz/delivery-auto-api
Informations about the package delivery-auto-api
Delivery-Auto API
PHP/Laravel client for Delivery-Auto 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
- PHP 8.2+
- Laravel 11, 12, or 13
spatie/laravel-data ^4.4
Installation
Publish the config:
Configuration
.env:
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
PostLoginreturns 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)
If your app holds several Delivery-Auto company keypairs (one per sender / counterparty), pass them per call instead of relying on the global config:
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
Modules
The seven module facades on DeliveryAuto::* mirror the seven sections of the PDF spec:
| Facade | PDF section | Auth | Purpose |
|---|---|---|---|
DeliveryAuto::reference() |
§1 Представництва | none | Region/city/warehouse directories |
DeliveryAuto::tracking() |
§2 Квитанції | none (HMAC for getStickers) |
TTN status, ETA, sticker metadata |
DeliveryAuto::calculation() |
§3 Розрахунок | none | Tariff lookup, calculator, insurance cost |
DeliveryAuto::communication() |
§4 Зв'язок із користувачем | none | News, message themes, service rating, pickup vehicle order |
DeliveryAuto::cabinet() |
§5, §6.14 | login session | User info, my receipts, pickup orders, deactivate reserved TTNs, full receipt info |
DeliveryAuto::receipt() |
§6 Оформлення | HMAC | Cards/invoices/senders, create TTN, deactivate cargo units, PDF docs, address/client creation |
DeliveryAuto::logs() |
§7 | login session | Receipt operation logs |
Reference
| Method | Returns | |
|---|---|---|
getRegionList |
§1.1 | DataCollection<RegionData> |
getAreasList (supports cityName autocomplete) |
§1.2 | DataCollection<AreaData> |
getWarehousesList |
§1.3 | DataCollection<WarehouseData> |
getWarehousesInfo |
§1.4 | WarehouseInfoData? |
getWarehousesListByCity |
§1.5 | DataCollection<WarehouseInfoData> |
getFindWarehouses (lat/lng + radius) |
§1.6 | DataCollection<WarehouseFindData> |
getWarehousesListInDetail |
§1.7 | DataCollection<WarehouseInfoData> |
Tracking
| Method | Returns | |
|---|---|---|
getReceiptDetails |
§2.1 | ReceiptData? (status int → enum) |
getDateArrival |
§2.2 | DateArrivalData? |
getStickers (HMAC) |
§6.16 | DataCollection<StickerData> |
Calculation
| Method | Returns | |
|---|---|---|
getDopUslugiClassification |
§3.2 | DataCollection<DopUslugaClassificationData> |
getTariffCategory |
§3.3 | DataCollection<TariffCategoryData> |
getCargoCategory (was wrongly auth-only pre-2.0) |
§3.4 | DataCollection<CargoCategoryData> |
getDeliveryScheme |
§3.5 | DataCollection<DeliverySchemeData> |
postReceiptCalculate |
§3.6 | CalculationData? |
getInsuranceCost |
§3.7 | InsuranceCostData? |
Communication
| Method | Returns | |
|---|---|---|
getNews (paginated) |
§4.2 | DataCollection<NewsItemData> |
getMessagesTheme |
§4.3 | DataCollection<MessageThemeData> |
postServiceRate |
§4.4 | bool |
postPickUpCargo |
§4.5 | bool |
Cabinet (login-auth)
| Method | Returns | |
|---|---|---|
postLogin |
§5.1 | bool (cookie persists in SessionStore) |
postLogoff |
§5.2 | bool (clears session) |
getUserInfo |
§5.3 | UserInfoData? |
getUserReceipt |
§5.4 | DataCollection<UserReceiptData> |
getUserPickUp |
§5.5 | DataCollection<UserPickUpData> |
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)
| Method | Returns | |
|---|---|---|
getClientCards |
§6.2 | DataCollection<ClientCardData> |
getClientInvoices |
§6.3 | DataCollection<ClientInvoiceData> |
postCreateReceipts |
§6.4 | DataCollection<CreatedReceiptData> |
postDeactivateEg |
§6.5 | bool |
getPdfDocument (base64-decoded PDF) |
§6.6 | PdfDocumentData? |
getSenderList |
§6.7 | DataCollection<SenderData> |
getCurrency |
§6.8 | DataCollection<SimpleNamedItemData> |
getAvailableServices |
§6.9 | AvailableServicesData? |
getPayer |
§6.10 | DataCollection<SimpleNamedItemData> |
getClientAddress |
§6.11 | DataCollection<SimpleNamedItemData> |
getPosibleReciver |
§6.12 | DataCollection<SimpleNamedItemData> |
getClientPaymentType |
§6.13 | bool (cash vs cashless) |
postCreateAddressOrClient |
§6.15 | CreatedAddressOrClientData? |
postAddReceiptIntoPickUpRequest |
§6.17 | bool |
Logs (login-auth)
| Method | Returns | |
|---|---|---|
getUnidersalLogsByReceiptNumber (sic — vendor typo) |
§7.1 | DataCollection<ReceiptLogData> |
SendingRegister URL builder
§6.18 returns HTML, not JSON, so we expose only a URL builder (no HTTP call):
Caching
Every module method supports ->cache($seconds). seconds = -1 (default) means cache forever:
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
| Enum | Type | Values |
|---|---|---|
Currency |
int | UAH = 100000000 (PDF §8.2) |
Country |
int | UA = 1 |
Culture |
string | UkUA, EnUS |
ReceiptStatus |
int | 14 states (0..13), with isFinal()/isSuccess()/isInTransit() |
ReceiptType |
int | 10 types (PDF §8.4) |
OrderState |
int | 4 states (PDF §8.5), with isOpen()/isCancelled() |
OperationCode |
int | Log 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
| Exception | Triggered by | Severity |
|---|---|---|
DeliveryAutoApiUnavailableException |
ConnectionException, 5xx response |
warning (transient infra) |
DeliveryAutoException |
4xx response, status: false payload |
error (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
Print labels & stickers
For sticker JSON metadata (without the PDF render), use DeliveryAuto::tracking()->getStickers(...).
Testing
Changelog
See UPGRADING.md for migration notes from 1.x.
Security
If you discover a security vulnerability, please email [email protected] instead of opening a public issue.
Credits
- Oleksandr Petrovskyi
- All Contributors
License
MIT — see LICENSE.md.
All versions of delivery-auto-api with dependencies
illuminate/config Version ^11.0||^12.0||^13.0
illuminate/http Version ^11.0||^12.0||^13.0
illuminate/support Version ^11.0||^12.0||^13.0
spatie/laravel-data Version ^4.4
spatie/laravel-package-tools Version ^1.16