Download the PHP package sashalenz/uklon-delivery-api without Composer

On this page you can find all versions of the php package sashalenz/uklon-delivery-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package uklon-delivery-api

Uklon Delivery API

CI Latest Version

Laravel SDK for the Uklon Delivery Gateway API — B2B intra-city courier delivery. Estimate fares, create and track orders, manage webhooks, all through a small fluent facade with fully-typed spatie/laravel-data DTOs.

Requirements

Installation

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

Configuration

Uklon issues OAuth credentials (app_uid, client_id, client_secret) per company, separately for the staging and production gateways. Add them to your .env:

Key Env Default
staging UKLON_DELIVERY_STAGING false
url UKLON_DELIVERY_API_URL https://deliverygateway.uklon.com.ua/api/v1
staging_url UKLON_DELIVERY_API_STAGING_URL https://deliverygateway.staging.uklon.com.ua/api/v1
app_uid UKLON_DELIVERY_APP_UID
client_id UKLON_DELIVERY_CLIENT_ID
client_secret UKLON_DELIVERY_CLIENT_SECRET
webhook_secret UKLON_DELIVERY_WEBHOOK_SECRET
timeout UKLON_DELIVERY_TIMEOUT 10

Authentication & token caching

You never call the auth endpoint yourself. Before each request the SDK obtains a bearer token from POST /auth and caches it (via Laravel's cache) for its expires_in lifetime, so repeated calls reuse the same token. On a 401 the cached token is dropped automatically so the next call re-authenticates. This is handled by TokenManager using your configured cache driver.

Usage

1. Estimate a fare

Every order starts with a fare estimate. The returned fare_id is required to create the order and expires (see expires_at).

2. Create an order

3. Track an order

4. List orders

Both lists are cursor-paginated and return an OrderListData (items + next_cursor).

5. Cancel an order

Reference data — cities

A city id is the city value for fare estimates. The list rarely changes, so cache it:

API surface

Call Method Endpoint
fare()->estimate($request) POST /fares/estimate
order()->create($request) POST /orders
order()->get($id) GET /orders/{id}
order()->getActive() GET /orders/active
order()->getArchived($limit, $cursor) GET /orders/archived
order()->getCourierLocation($id) GET /orders/{id}/driver/location
order()->cancel($id, $request) PUT /orders/{id}/cancel
webhook()->setForOrder($request) POST /webhooks/order
webhook()->getForOrder() GET /webhooks/order
webhook()->deleteForOrder() DELETE /webhooks/order
webhook()->setForDriver($request) POST /webhooks/driver
webhook()->getForDriver() GET /webhooks/driver
webhook()->deleteForDriver() DELETE /webhooks/driver
city()->all() GET /cities

Webhooks

Uklon can push order-update and driver-location events to your app. You register a subscription with a callback URL and a shared key (secret), one of each per company.

Registering a subscription

Handling incoming events

Parse the request body into typed DTOs in your controller:

Verifying signatures

Every webhook delivery is signed with the key you registered, using HMAC-SHA256 over the raw request body; the signature is sent in the X-Signature header. A delivery whose signature does not match must be ignored as malformed or forged.

The package ships a ready-to-use middleware registered under the uklon-webhook alias. It reads the secret from uklon-delivery-api.webhook_secret (UKLON_DELIVERY_WEBHOOK_SECRET) and returns 403 on a bad signature:

Storing secrets elsewhere (e.g. multi-tenant)? Pass a config key to the middleware: ->middleware('uklon-webhook:services.uklon.order_secret').

Or verify manually with WebhookSignatureValidator:

Enums

Enum Values
OrderStatus placed, waiting_for_processing, processing, accepted, arrived, running, returning, completed, suspended, canceled — plus isCourierAssigned(), isFinal()
CancelReason package_not_fit, trunk_occupied, plans_changed, driver_refused_package, driver_low_rating, driver_behavior, driver_was_late, driver_not_arrived, driver_confused_address, driver_ignore, driver_too_far, driver_asked, another_vehicle
Product car, courier
DropoffStatus delivering, arrived, delivered, not_delivered, return_requested, returning, returned
IdleState none, free, paid
DisabilityType none, deaf, hard_hearing

Caching

Any read can be memoised through the configured cache driver:

Error handling

All errors extend a single base exception:

UklonDeliveryApiUnavailableException extends UklonDeliveryException, so catch the base type if you don't need to distinguish them.

Testing

License

The MIT License (MIT). See License File.


All versions of uklon-delivery-api with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
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
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sashalenz/uklon-delivery-api contains the following files

Loading the files please wait ...