PHPackages                             mijora/omniva-api - 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. [API Development](/categories/api)
4. /
5. mijora/omniva-api

ActiveLibrary[API Development](/categories/api)

mijora/omniva-api
=================

Omniva API wrapper

1.3.7(4mo ago)1591.6k↓30.4%8[1 PRs](https://github.com/omniva-baltic/omniva-api-lib/pulls)PHP

Since Feb 3Pushed 4mo ago5 watchersCompare

[ Source](https://github.com/omniva-baltic/omniva-api-lib)[ Packagist](https://packagist.org/packages/mijora/omniva-api)[ RSS](/packages/mijora-omniva-api/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (10)Dependencies (6)Versions (39)Used By (0)

Omniva Api library
==================

[](#omniva-api-library)

Omniva API library, to help to integrate with other systems

Features
--------

[](#features)

- Shipment creating
- Label printing. You can download, inline view or save to file. Combine labels or print in seperate pages.
- Manifest generation. You can download, inline view or save to file.
- Tracking by barcode
- Courier call, to ask to pickup parcels from shop.
- List parcel terminals.

Requirements
------------

[](#requirements)

- Minimum PHP 5.6, tested up to PHP 7.4

Instalation
-----------

[](#instalation)

To install via composer:

```
composer require mijora/omniva-api
```

How to use
----------

[](#how-to-use)

All examples can be viewed in `example/` folder. Use `example/config.php` to enter your API username and password for testing the examples.

Creating shipment
-----------------

[](#creating-shipment)

```
    use Mijora\Omniva\OmnivaException;
    use Mijora\Omniva\Shipment\Package\AdditionalService;
    use Mijora\Omniva\Shipment\Package\Address;
    use Mijora\Omniva\Shipment\Package\Contact;
    use Mijora\Omniva\Shipment\Package\Measures;
    use Mijora\Omniva\Shipment\Package\Cod;
    use Mijora\Omniva\Shipment\Package\Package;
    use Mijora\Omniva\Shipment\Shipment;
    use Mijora\Omniva\Shipment\ShipmentHeader;

    //create new shipment object
    $shipment = new Shipment();
    $shipment
            ->setComment('Test comment')  //set comment, optional
            ->setShowReturnCodeEmail(true) //return code in receiver email, optional
            ->setShowReturnCodeSms(true); //return code in receiver sms, optional

    //new shipment header object, required
    $shipmentHeader = new ShipmentHeader();
    $shipmentHeader
            ->setSenderCd($username) //set username
            ->setFileId(date('Ymdhis')); //set date of shipment creation

    //assign header to shipment
    $shipment->setShipmentHeader($shipmentHeader);

    //new shipment package object, required
    $package = new Package();
    $package
            ->setId('5454') //id number, optional. Use same ID for several Package if want use multiparcels service
            ->setService('QH') //service code of package
            ->setContentDescription('2×Cap; 1×Hoodie; 3×Shirts'); //Description of package contents. Required for international shipments. Max 500 chars

    //create additional services and add to package, optional
    $additionalService = (new AdditionalService())->setServiceCode('SS');
    $package->setAdditionalServices([$additionalService]);
    //for available service codes, you can view at https://www.omniva.lt/public/files/failid/omniva-service-codes-lt-eng.pdf

    //set package size and weight
    $measures = new Measures();
    $measures
            ->setWeight(6.689) //weight in kg, required
            ->setLength(0.9) //dimension in meter, optional
            ->setHeight(0.25) //dimension in meter, optional
            ->setWidth(1); //dimension in meter, optional
    $package->setMeasures($measures); //set package measurements

    //set COD, optional
    $cod = new Cod();
    $cod
            ->setAmount(66.72) //set cod amount
            ->setBankAccount('GB33BUKB20201555555555') //set bank account
            ->setReceiverName('Test Company') //set company name
            ->setReferenceNumber('2323'); //set reference number of COD. For Estonia the number is generated according to Method 7-3-1 (https://www.pangaliit.ee/arveldused/viitenumber/7-3-1meetod)
    $package->setCod($cod); //assign cod to package

    //set sender and reeiver address
    $receiverContact = new Contact(); //receiver contact object
    $receiverAddress = new Address(); //receiver address object
    $receiverAddress
            ->setCountry('LT') //set country code (2 letters)
            ->setPostcode('72201') //set postcode (LT, EE and FI are "00000", for LV the format is "LV-0000")
            ->setDeliverypoint('Kaunas') //set city and state (up to 80 chars)
            ->setOffloadPostcode('68594') //set terminal code if sending to parcel terminal
            ->setStreet('Guobu g. 5-266'); //set street, house and apartment number (up to 80 chars)
    $receiverContact
            ->setAddress($receiverAddress) //assign address to receiver
            ->setEmail('test@test.lt') //set receiver email
            ->setMobile('+37060000000') //set receiver phone (recommended in international format)
            ->setPersonName('Moby Simpson'); //set receiver full name
    $package->setReceiverContact($receiverContact); //assign receiver to package

    $senderContact = new Contact(); //sender contact object
    $senderAddress = new Address(); //sender address object
    $senderAddress
            ->setCountry('LV') //set country code (2 letters)
            ->setPostcode('LV-1234') //set postcode (LT, EE and FI are "00000", for LV the format is "LV-0000")
            ->setDeliverypoint('Riga') //set city and state (up to 80 chars)
            ->setStreet('Pils iela 3'); //set street, house and apartment number (up to 80 chars)
    $senderContact
            ->setAddress($senderAddress) //assign address to sender
            ->setMobile('+37125700000') //set sender phone
            ->setPersonName('Stefan Dexter'); //set sender full name
    $package->setSenderContact($senderContact); //assign sender to package

    //set packages to shipment, in this case we assign 2 same packeges for shipment
    $shipment->setPackages([$package, $package]);

    //hide return code from customer SMS and email
    $shipment->setShowReturnCodeSms(false);
    $shipment->setShowReturnCodeEmail(false);

    //set auth data
    $shipment->setAuth($username, $password);

    //register shipment to Omniva, on success, will return $result['barcodes'], else throw OmnivaException exception with error message
    $result = $shipment->registerShipment();
```

Get shipment label
------------------

[](#get-shipment-label)

```
    use Mijora\Omniva\OmnivaException;
    use Mijora\Omniva\Shipment\Label;

    $label = new Label(); //new label object
    $label->setAuth($username, $password); //set auth data

    //return labels pdf or thow OmnivaException on error
    //default function attributes downloadLabels($barcodes, $combine = true, $mode = 'I', $name = 'Omniva labels')
    //$barcodes - string or array of strings
    //$combine - if true, will add 4 labels per page, else 1 label per page
    //$mode - I: return directly to browser preview, S: return pdf as string data, D: force browser to download
    //$name - name of file
    $label->downloadLabels($barcodes);
```

Get manifest
------------

[](#get-manifest)

```
    use Mijora\Omniva\OmnivaException;
    use Mijora\Omniva\Shipment\Manifest;
    use Mijora\Omniva\Shipment\Order;
    use Mijora\Omniva\Shipment\Package\Address;
    use Mijora\Omniva\Shipment\Package\Contact;

    $address = new Address(); //sender address object
    $address
            ->setCountry('LT') //set country code
            ->setPostcode('72201') //set post code
            ->setDeliverypoint('City') //set city
            ->setStreet('Test g.'); //set street

    $senderContact = new Contact(); //sender contact object
    $senderContact
            ->setAddress($address) //add address to to contact
            ->setMobile('+37060000000') //set phone
            ->setPersonName('Stefan Dexter'); //set sender full name

    $manifest = new Manifest(); //new manifest object
    $manifest
            ->setSender($senderContact) //add sender contact
            ->showBarcode(false) //disable barcode image display
            ->setSignatureLineLength(40) //change the length of the signature line
            ->setString('sender_address', 'Shop address') //change string in manifest. First value is string key. Available keys: sender_address, row_number, shipment_number, order_number, date, quantity, weight, recipient_address, courier_signature, sender_signature
            ->setColumnLength('row_number', 20); //change orders table column width. First value is column key. Available keys: row_number, shipment_number, order_number, date, quantity, weight, recipient_address

    $order = new Order(); //new order object
    $order->setTracking('BK000000000LT'); //set tracking number
    $order->setQuantity('2'); //set quanitty of packages
    $order->setWeight('1'); //set weight in kg
    $order->setReceiver('Test receiver, City, 12345, LT'); //set full receiver address
    $manifest->addOrder($order); //add order to manifest

    //get manifest pdf
    //first attribute - I: return directly to browser preview, S: return pdf as string data, D: force browser to download
    //second - pdf file name
    $manifest->downloadManifest('I', 'Manifest file name');
```

Call courier for pickup
-----------------------

[](#call-courier-for-pickup)

Anytime during setup or when calling api Exception can be thrown with errors.

```
    use Mijora\Omniva\OmnivaException;
    use Mijora\Omniva\Shipment\CallCourier;
    use Mijora\Omniva\Shipment\Package\Address;
    use Mijora\Omniva\Shipment\Package\Contact;

    $address = new Address(); //pickup address object
    $address
            ->setCountry('LT') //set country code
            ->setPostcode('72201') //set post code
            ->setDeliverypoint('City') //set city
            ->setStreet('Test g.'); //set street

    //pickup contact data
    $senderContact = new Contact();
    $senderContact
            ->setAddress($address) //assign pickup address object
            ->setMobile('+37060000000') //set phone
            ->setPersonName('Stefan Dexter'); //set full name of sender

    //call courier object
    $call = new CallCourier();
    $call
        ->setAuthsetAuth($username, $password, $api_url, true); // set auth info. Username (required), password (required), API url (optional), debug (optional)
        ->setSender($senderContact) // assign pickup address
        ->setEarliestPickupTime('08:00') // set pickup start time, day will be chosen based on this time (either same day or next day)
        ->setLatestPickupTime('17:00') // set picktup end time
        ->setComment('Third door on he left') // set comment for courier. New with OMX
        ->setIsHeavyPackage(true) // set true if any of packages >30kg, default is false. New with OMX
        ->setIsTwoManPickup(false) // set true if pickup requires two people. Default is false. New with OMX
        ->setTimezone('Europe/Vilnius') // set timezone to use for calculation of pickup date time. New with OMX
        ->setParcelsNumber(3); // specify how many packages will be handed over to the courier

    $pickup_call_id = $call->callCourier(); // make a call, returns call ID which can be used to cancel pickup call
    $debug_data = $call->getDebugData(); //return debug data which contain URL, HTTP code, request and response. only if debug = true
```

Cancel courier for pickup. New in OMX
-------------------------------------

[](#cancel-courier-for-pickup-new-in-omx)

Anytime during setup or when calling api Exception can be thrown with errors. Requires to have Pickup Call ID

```
    use Mijora\Omniva\OmnivaException;
    use Mijora\Omniva\Shipment\CallCourier;

    $address = new Address(); //pickup address object
    $address
            ->setCountry('LT') //set country code
            ->setPostcode('72201') //set post code
            ->setDeliverypoint('City') //set city
            ->setStreet('Test g.'); //set street

    //pickup contact data
    $senderContact = new Contact();
    $senderContact
            ->setAddress($address) //assign pickup address object
            ->setMobile('+37060000000') //set phone
            ->setPersonName('Stefan Dexter'); //set full name of sender

    //call courier object
    $call = new CallCourier();
    // set auth info. Username (required), password (required), API url (optional), debug (optional)
    $call->setAuthsetAuth($username, $password, $api_url, true);

    // $pickup_call_id is ID that was returned during courier pickup call
    $result = $call->cancelCourierOmx($pickup_call_id); // result = true if cancelation was successful
    $debug_data = $call->getDebugData(); //return debug data which contain URL, HTTP code, request and response. only if debug = true
```

Get list of parcel terminals
----------------------------

[](#get-list-of-parcel-terminals)

```
    use Mijora\Omniva\Locations\PickupPoints;

    $omnivaPickupPointsObj = new PickupPoints(); //terminals object

    //returns array list of terminals or OmnivaException on error
    $terminals = $omnivaPickupPointsObj->getFilteredLocations('lt', 0, 'Kauno apskr.'); //can be optionally filtered by country code, type, and county
```

Get tracking information
------------------------

[](#get-tracking-information)

```
    use Mijora\Omniva\Shipment\Tracking;

    $tracking = new Tracking(); //tracking object
    $tracking->setAuth($username, $password); //set auth data

    //return array of events or OmnivaException on error
    $result = $tracking->getTrackingOmx($barcode); //pass string of barcode

    //result array with events, each with an ID, code, name and date
    if (is_array($result)) {
        foreach ($result as $event) {
            echo $event['eventId'] . ': ' . (new DateTime($event['eventDate']))->format('Y-m-d H:i:s') . ' ' . $event['eventCode'] . ' ' . $event['eventName'] . '';
        }
    }
```

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance74

Regular maintenance activity

Popularity42

Moderate usage in the ecosystem

Community17

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 68.9% 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 ~50 days

Recently: every ~85 days

Total

31

Last Release

147d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/99d8451bba0fced79053e83b1df36276db8b653cee4802464750a45463b181ee?d=identicon)[Mijora](/maintainers/Mijora)

---

Top Contributors

[![markakk](https://avatars.githubusercontent.com/u/71830881?v=4)](https://github.com/markakk "markakk (144 commits)")[![LithMage](https://avatars.githubusercontent.com/u/15011435?v=4)](https://github.com/LithMage "LithMage (54 commits)")[![pampyras](https://avatars.githubusercontent.com/u/3141103?v=4)](https://github.com/pampyras "pampyras (6 commits)")[![modex9](https://avatars.githubusercontent.com/u/20166429?v=4)](https://github.com/modex9 "modex9 (5 commits)")

### Embed Badge

![Health badge](/badges/mijora-omniva-api/health.svg)

```
[![Health](https://phpackages.com/badges/mijora-omniva-api/health.svg)](https://phpackages.com/packages/mijora-omniva-api)
```

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k39.6k](/packages/matomo-matomo)[horstoeko/zugferd

A library for creating and reading european electronic invoices

4306.4M37](/packages/horstoeko-zugferd)[myparcelnl/sdk

This package is designed to send and receive data from MyParcel by means of an API.

31536.1k29](/packages/myparcelnl-sdk)[atgp/factur-x

PHP library to manage your Factur-X / ZUGFeRD 2.0 PDF invoices files

154947.6k4](/packages/atgp-factur-x)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

762297.9k53](/packages/civicrm-civicrm-core)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.8M672](/packages/shopware-core)

PHPackages © 2026

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