tcgunel/omniship-horoz

Horoz Lojistik carrier for Omniship shipping library

Maintainers

Package info

github.com/tcgunel/omniship-horoz

pkg:composer/tcgunel/omniship-horoz

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.0.2 2026-03-13 09:04 UTC

This package is auto-updated.

Last update: 2026-03-13 09:39:56 UTC


README

Horoz Lojistik carrier driver for the Omniship shipping library.

Uses the Horoz B2B REST API with process key authentication.

Installation

composer require tcgunel/omniship-horoz

Usage

Initialize

use Omniship\Omniship;

$carrier = Omniship::create('Horoz');
$carrier->initialize([
    'processKey' => 'your-process-key',
    'senderCode' => 12345,
    'testMode' => true, // false for production
]);

Create Shipment

Horoz uses a two-step shipment creation flow:

  1. createShipment() — registers the shipment
  2. createBarcode() — generates tracking number, barcode, and ZPL label

Note: All string values are automatically uppercased per Horoz API requirements.

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

// Step 1: Create the shipment
$response = $carrier->createShipment([
    'shipFrom' => new Address(
        name: 'Ahmet Yilmaz',
        street1: 'Ataturk Cad. No:42',
        city: 'Istanbul',
        district: 'Kadikoy',
        postalCode: '34710',
        country: 'TR',
        phone: '05551234567',
    ),
    'shipTo' => new Address(
        name: 'Mehmet Demir',
        street1: 'Kizilirmak Cad. No:5',
        city: 'Ankara',
        district: 'Cankaya',
        postalCode: '06420',
        country: 'TR',
        phone: '05559876543',
    ),
    'packages' => [
        new Package(weight: 2.5, length: 30, width: 20, height: 15),
    ],
    'reference' => 'ORDER-001',
    'paymentType' => PaymentType::SENDER,
])->send();

if ($response->isSuccessful()) {
    $requestNumber = $response->getShipmentId(); // Horoz request number

    // Step 2: Create barcode to get tracking number and label
    $barcodeResponse = $carrier->createBarcode([
        'requestNumber' => $requestNumber,
        'partNumber' => 1,
        'quantity' => 1,
        'desi' => 3.0,
        'weightInKg' => 2.5,
    ])->send();

    if ($barcodeResponse->isSuccessful()) {
        echo $barcodeResponse->getTrackingNumber(); // tracking number
        echo $barcodeResponse->getBarcode();         // barcode string

        $label = $barcodeResponse->getLabel();       // ZPL label
        if ($label !== null) {
            echo $label->format->value; // "ZPL"
        }
    }
}

Cancel Shipment

$response = $carrier->cancelShipment([
    'requestNumber' => 'REQ-001',
])->send();

if ($response->isCancelled()) {
    echo 'Shipment cancelled';
}

API Details

  • Transport: REST/JSON via PSR-18 HTTP client
  • Auth: processKey header
  • Base URL: http://b2b.horoz.com.tr:7800/horozshipping/v1 (prod)
  • Test URL: http://b2b.horoz.com.tr:7800/horozshipping_test/v1
  • Create Shipment: POST /createShipping
  • Create Barcode: POST /createBarcode
  • Cancel: POST /cancelShipping

Note: Horoz does not provide a tracking query endpoint. Tracking information is returned in the createBarcode response.

Testing

vendor/bin/pest

License

MIT