Download the PHP package tcgunel/omniship-common without Composer
On this page you can find all versions of the php package tcgunel/omniship-common. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tcgunel/omniship-common
More information about tcgunel/omniship-common
Files in tcgunel/omniship-common
Package omniship-common
Short Description Multi-carrier shipping abstraction for PHP
License MIT
Informations about the package omniship-common
Omniship Common
Multi-carrier shipping abstraction library for PHP. Like Omnipay, but for shipping.
Requirements
- PHP 8.2+
- PSR-18 HTTP client implementation
- PSR-17 HTTP factory implementation
Installation
Architecture
Each carrier is a separate package that extends the appropriate base class.
The two base classes take different constructor arguments — an HTTP carrier
accepts a PSR-18 client, a SOAP carrier accepts a SoapClient. Ask before you
instantiate, rather than assuming:
Available Carriers
| Package | Carrier | Type | Auth |
|---|---|---|---|
tcgunel/omniship-yurtici |
Yurtiçi Kargo | SOAP | Username/Password |
tcgunel/omniship-aras |
Aras Kargo | HTTP/XML | Username/Password |
tcgunel/omniship-kolaygelsin |
KolayGelsin (Sendeo) | HTTP/JSON | API Token |
Quick Start
Common Operations
Every carrier supports these operations:
Create Shipment
Track Shipment
Cancel Shipment
Logging SOAP Traffic
SOAP carriers build their own SoapClient from the WSDL, so there is no PSR-18
client to wrap. Supply a factory to hand them a client of your own — typically a
subclass that overrides __doRequest() to record every exchange:
The factory receives the carrier's WSDL URL and SOAP options, and is called once,
lazily, on the first request. Passing a ready-made client to the constructor (or
setSoapClient()) still works when you do not need the WSDL.
Parameter Handling
Parameters usually arrive from HTTP input, where everything is a string, while
setters are typed for the carrier's API. initialize() bridges that:
- null means "not configured" and is skipped, so an unconfigured optional
credential no longer throws a
TypeErrorout of astring-typed setter. Setters declared?stringstill receive it, so a carrier can tell "cleared" from "never set". - scalars are coerced to the declared type when nothing is lost.
'1'reaches anintsetter as1,1reaches astringsetter as'1'. This matters because carriers disagree: Yurtiçi typescodCollectionTypeasint, Aras asstring, and one payload has to drive both. A lossy value ('abc'or'1.5'into anint) is passed through untouched so a real mistake still fails loudly.
Domain Models
Address
Package
ShipmentStatus Enum
Key Concepts for Turkish Carriers
- Desi: Volumetric weight = (L x W x H) / 3000. First-class field on Package.
- District (İlçe): Required by all Turkish carriers. Maps to
Address::$district. - Barcode: Turkish carriers return a barcode string on shipment creation.
- PaymentType: Sender/receiver pays. Standard in Turkish e-commerce.
- COD (Kapıda Ödeme): Cash on delivery with
cashOnDeliveryflag +codAmount.
Testing
License
MIT
All versions of omniship-common with dependencies
php-http/discovery Version ^1.19
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1|^2.0
psr/log Version ^3.0