PHPackages                             tcgunel/omniship-ups - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. tcgunel/omniship-ups

ActiveLibrary[HTTP &amp; Networking](/categories/http)

tcgunel/omniship-ups
====================

UPS Turkey carrier for Omniship shipping library

v0.0.2(2mo ago)03↓100%MITPHPPHP ^8.2

Since Mar 12Pushed 2mo agoCompare

[ Source](https://github.com/tcgunel/omniship-ups)[ Packagist](https://packagist.org/packages/tcgunel/omniship-ups)[ RSS](/packages/tcgunel-omniship-ups/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (5)Versions (3)Used By (0)

Omniship UPS Kargo
==================

[](#omniship-ups-kargo)

UPS Turkey (UPS Kargo) carrier driver for the [Omniship](https://github.com/tcgunel/omniship) shipping library.

Uses the UPS Turkey domestic SOAP API with session-based authentication.

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

[](#installation)

```
composer require tcgunel/omniship-ups
```

Usage
-----

[](#usage)

### Initialize

[](#initialize)

```
use Omniship\Omniship;

$carrier = Omniship::create('UPS');
$carrier->initialize([
    'username' => 'your-username',
    'password' => 'your-password',
    'customerNumber' => 'your-customer-number',
    'testMode' => true, // false for production
]);
```

### Create Shipment

[](#create-shipment)

UPS Turkey requires numeric **CityCode** and **AreaCode** for both shipper and consignee addresses. These are UPS-specific codes (see `UmoCityAreaCode.xls` in docs).

```
use Omniship\Common\Address;
use Omniship\Common\Package;
use Omniship\Common\Enum\PaymentType;

$response = $carrier->createShipment([
    'shipFrom' => new Address(
        name: 'Serkan Kose',
        company: 'UPS TURKIYE',
        street1: 'Mevlana Cd. No:85 UPS Plaza',
        city: 'Istanbul',
        postalCode: '34896',
        phone: '02124132222',
        email: 'skose@ups.com',
    ),
    'shipTo' => new Address(
        name: 'Ismet Kutuk',
        company: 'KOSE A.S.',
        street1: 'Dumlupinar Mh. Alibaba Cd. No:57',
        city: 'Istanbul',
        postalCode: '34400',
        phone: '04444444444',
        email: 'ismet@example.com',
    ),
    'packages' => [
        new Package(
            weight: 2.0,
            length: 20,
            width: 25,
            height: 15,
            description: 'ORTA BOY KOLI',
        ),
    ],
    'shipperCityCode' => 34,          // required - UPS city code
    'shipperAreaCode' => 1707,         // required - UPS area code
    'consigneeCityCode' => 34,         // required - UPS city code
    'consigneeAreaCode' => 463,        // required - UPS area code
    'serviceLevel' => 3,              // 3=Standard (default)
    'packageType' => 'K',             // K=Package, D=Letter
    'paymentType' => PaymentType::SENDER,
    'invoiceNumber' => 'INV-001',     // optional
    'reference' => 'REF-001',         // optional
    'cashOnDelivery' => false,
    'codAmount' => 0.0,
    'codCurrency' => 'TL',
])->send();

if ($response->isSuccessful()) {
    echo $response->getTrackingNumber(); // "1Z340006800001006"
    echo $response->getShipmentId();     // same as tracking number
    echo $response->getBarcode();        // base64 PNG barcode image
    echo $response->getLabelLink();      // URL for label printing

    // All barcode images (one per package)
    $barcodes = $response->getBarcodeArray();

    // Label object with format info
    $label = $response->getLabel();
} else {
    echo $response->getMessage(); // error description
    echo $response->getCode();    // UPS error code
}
```

### Track Shipment

[](#track-shipment)

Tracking uses the separate Query Package Info web service. The system logs in automatically.

```
$response = $carrier->getTrackingStatus([
    'trackingNumber' => '1Z340006800001006',
])->send();

if ($response->isSuccessful()) {
    $info = $response->getTrackingInfo();
    echo $info->trackingNumber;
    echo $info->status->value;  // pre_transit, in_transit, delivered, etc.
    echo $info->carrier;        // "UPS Kargo"
    echo $info->signedBy;       // person who signed for delivery

    foreach ($info->events as $event) {
        echo $event->description;
        echo $event->occurredAt->format('Y-m-d H:i');
        echo $event->location;   // branch name
        echo $event->status->value;
    }
}
```

### Cancel Shipment

[](#cancel-shipment)

```
$response = $carrier->cancelShipment([
    'trackingNumber' => '1Z340006800001006',
])->send();

if ($response->isCancelled()) {
    echo 'Shipment cancelled';
} else {
    echo $response->getMessage(); // error description
}
```

### Get Rates

[](#get-rates)

Rate queries require **CityCode** and **AreaCode** for both shipper and consignee (same codes as `createShipment`).

```
use Omniship\Common\Package;
use Omniship\Common\Enum\PaymentType;

$response = $carrier->getRates([
    'shipperCityCode' => 34,          // required - UPS city code
    'shipperAreaCode' => 1707,         // required - UPS area code
    'consigneeCityCode' => 6,          // required - UPS city code
    'consigneeAreaCode' => 463,        // required - UPS area code
    'packages' => [
        new Package(weight: 2.0),
    ],
    'paymentType' => PaymentType::SENDER,
])->send();

if ($response->isSuccessful()) {
    foreach ($response->getRates() as $rate) {
        echo $rate->serviceCode;       // "3"
        echo $rate->serviceName;       // "DOM. STANDARD"
        echo $rate->totalPrice;        // 45.50 (tax-inclusive)
        echo $rate->currency;          // "TL"
        echo $rate->transitDays;       // 2
    }
}
```

Service Levels
--------------

[](#service-levels)

CodeService1DOM. EXPRESS PLUS 09:003DOM. STANDARD (default)4DOM. EXPRESS 10:305DOM. EXPRESS 12:006DOM. EXPRESS SAVERPayment Types
-------------

[](#payment-types)

CodeDescriptionOmniship Enum1Consignee (receiver) pays`PaymentType::RECEIVER`2Shipper (sender) pays`PaymentType::SENDER`4Third party pays`PaymentType::THIRD_PARTY`Status Mapping
--------------

[](#status-mapping)

UPS StatusCodeOmniship StatusDescription1Varies by descriptionNormal event (keyword-matched)2`DELIVERED`Delivery event3`FAILURE`Exception eventFor StatusCode 1, the status is inferred from Turkish keywords in the event description (kabul, aktarma, dagitim, teslim, iade, etc.).

API Endpoints
-------------

[](#api-endpoints)

ServiceURLCreate Shipment`https://ws.ups.com.tr/wsCreateShipment/wsCreateShipment.asmx`Package Query`https://ws.ups.com.tr/QueryPackageInfo/wsQueryPackagesInfo.asmx`SOAP Methods Used
-----------------

[](#soap-methods-used)

OperationServiceSOAP MethodPurposeLoginCreate Shipment`Login_Type1`Get session ID for shipment serviceLoginPackage Query`Login_V1`Get session ID for tracking serviceCreateCreate Shipment`CreateShipment_Type3`Create shipment with dimensionsTrackPackage Query`GetTransactionsByTrackingNumber_V1`Get all tracking eventsCancelCreate Shipment`CancelShipment`Cancel a shipment by tracking numberGet RatesCreate Shipment`GetRate`Get rate quotes by city/area codesSession Management
------------------

[](#session-management)

UPS Turkey uses session-based authentication. Each API call:

1. Calls `Login_Type1` (or `Login_V1`) to get a `SessionID`
2. Uses that `SessionID` for the actual operation

Sessions expire after 5 minutes of inactivity. The library handles login automatically on each request.

Testing
-------

[](#testing)

```
vendor/bin/pest
```

License
-------

[](#license)

MIT

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance88

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

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

Every ~0 days

Total

2

Last Release

60d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/36dffe883e88aeef07c26067af3d6a7eda1c2a81f1ae45fdd430b721665131da?d=identicon)[Mobius Studio](/maintainers/Mobius%20Studio)

---

Top Contributors

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

###  Code Quality

TestsPest

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tcgunel-omniship-ups/health.svg)

```
[![Health](https://phpackages.com/badges/tcgunel-omniship-ups/health.svg)](https://phpackages.com/packages/tcgunel-omniship-ups)
```

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)[php-http/curl-client

PSR-18 and HTTPlug Async client with cURL

48247.0M384](/packages/php-http-curl-client)

PHPackages © 2026

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