dotsplatform / nova-poshta-api-sdk-laravel
Laravel package for the Nova Poshta classic API 2.0 - https://developers.novaposhta.ua/
Package info
github.com/dotsplatform/nova-poshta-api-sdk-laravel
pkg:composer/dotsplatform/nova-poshta-api-sdk-laravel
1.0.0
2026-11-27 20:23 UTC
Requires
- php: ^8.5
- dotsplatform/utils: ^2.3
- illuminate/support: *
- saloonphp/saloon: ^4.0
Requires (Dev)
- eduarguz/shift-php-cs: ^3.0
- larastan/larastan: ^3.0
- laravel/laravel: ^13.0
- orchestra/testbench: ^11.0
- phpunit/phpunit: ^12.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-28 10:59:04 UTC
README
Thin Saloon connector for the Nova Poshta classic API 2.0 (https://api.novaposhta.ua/v2.0/json/).
Usage
use Dots\NovaPoshta\Client\NovaPoshtaConnectorBuilder; use Dots\NovaPoshta\Client\Requests\Address\DTO\SearchSettlementsDTO; $connector = app(NovaPoshtaConnectorBuilder::class)->build($merchantApiKey); $settlements = $connector->searchSettlements(SearchSettlementsDTO::fromArray([ 'cityName' => 'київ', ]));
- The API key belongs to the sender (merchant) counterparty, so the connector is built per key.
Directory methods (
searchSettlements,getWarehouses,searchSettlementStreets,getWarehouseTypes,getDocumentPrice,getDocumentDeliveryDate) also work withbuild(null)and return public data. - Nova Poshta answers every call with HTTP 200. A response with
"success": falsethrowsDots\NovaPoshta\Client\Exceptions\NovaPoshtaApiExceptionwithgetErrorCodes(),getErrors(),getWarnings(). Codes live inClient\Entities\NovaPoshtaErrorCode. getStatusDocuments()accepts at most 100 documents (GetStatusDocumentsRequest::MAX_DOCUMENTS_PER_REQUEST).- The API has no sandbox.
deleteInternetDocuments()removes a waybill while it has not been handed over.
Configuration
config/nova-poshta-api-sdk.php:
| Key | Env | Default |
|---|---|---|
base_url |
NOVA_POSHTA_API_BASE_URL |
https://api.novaposhta.ua/v2.0/json/ |
timeout_seconds |
NOVA_POSHTA_API_TIMEOUT_SECONDS |
15 |
Testing in consumers
Dots\NovaPoshta\Mock\NovaPoshtaResponseMocker adds responses to the global Saloon MockClient
(several requests can be mocked in one test). Call MockClient::destroyGlobal() in tearDown().
NovaPoshtaResponseMocker::mockSaveInternetDocument(['IntDocNumber' => '20450123456789']); NovaPoshtaResponseMocker::mockError(SaveInternetDocumentRequest::class, ['20000900746'], ['Phone is invalid']);
Development
composer install composer init-pre-commit vendor/bin/phpunit vendor/bin/phpstan analyse --memory-limit=2G