tcgunel / omniship-horoz
Horoz Lojistik carrier for Omniship shipping library
v0.0.2
2026-03-13 09:04 UTC
Requires
- php: ^8.2
- tcgunel/omniship-common: ^0.0.1
Requires (Dev)
- guzzlehttp/guzzle: ^7.0
- guzzlehttp/psr7: ^2.0
- pestphp/pest: ^3.0
- phpstan/phpstan: ^2.0
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:
createShipment()— registers the shipmentcreateBarcode()— 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:
processKeyheader - 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
createBarcoderesponse.
Testing
vendor/bin/pest
License
MIT