tcgunel/omniship-horoz
最新稳定版本:v0.0.2
Composer 安装命令:
composer require tcgunel/omniship-horoz
包简介
Horoz Lojistik carrier for Omniship shipping library
README 文档
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
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-13