PHPackages                             inspirum/balikobot - 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. inspirum/balikobot

ActiveLibrary[API Development](/categories/api)

inspirum/balikobot
==================

PHP library for Balikobot API

v7.14.0(1mo ago)20379.7k↓20.1%123MITPHPPHP ^8.1CI passing

Since Dec 27Pushed 1mo ago3 watchersCompare

[ Source](https://github.com/inspirum/balikobot-php)[ Packagist](https://packagist.org/packages/inspirum/balikobot)[ Docs](https://github.com/inspirum/balikobot-php)[ RSS](/packages/inspirum-balikobot/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (17)Versions (65)Used By (3)

Balikobot API
=============

[](#balikobot-api)

[![Latest Stable Version](https://camo.githubusercontent.com/7194063f08c8ef2c705297018059b16d4b451a7b6fddd520460c260eff55354f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696e73706972756d2f62616c696b6f626f742e7376673f7374796c653d666c61742d73717561726526636f6c6f72423d626c7565)](https://packagist.org/packages/inspirum/balikobot)[![Build Status](https://camo.githubusercontent.com/9ad0887952a82e8ebe3979a3e81d0484895074dcebefca7c5b9c7b9a1b2d8334/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f696e73706972756d2f62616c696b6f626f742d7068702f6d61737465722e796d6c3f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)](https://github.com/inspirum/balikobot-php/actions)[![Coverage Status](https://camo.githubusercontent.com/a76e56b227bd98fc00fa9493c40cbac58fb894dc15d999dfca9bf94189bf05ce/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f696e73706972756d2f62616c696b6f626f742d7068702f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/inspirum/balikobot-php/code-structure)[![Quality Score](https://camo.githubusercontent.com/29e61e6d4a441e7d206fb9d5d51a82831aae1d0149d6e6c3d3a3a155a8fa5896/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f696e73706972756d2f62616c696b6f626f742d7068702e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/inspirum/balikobot-php)[![PHPStan](https://camo.githubusercontent.com/3bcae20044ccbc7418cae0e9264f3cd12df82ccf921f56e5dd42663b64c4b060/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7374796c652d6c6576656c253230382d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265266c6162656c3d7068707374616e)](https://github.com/phpstan/phpstan)[![Total Downloads](https://camo.githubusercontent.com/923bcc27c14e0fc3f31a004f2bf08fb6437959dad17fbdb32c4ecdcc59eaa400/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696e73706972756d2f62616c696b6f626f742e7376673f7374796c653d666c61742d73717561726526636f6c6f72423d626c7565)](https://packagist.org/packages/inspirum/balikobot/stats)[![Software License](https://camo.githubusercontent.com/be5603128704b9b2dc4f42e6f6e591a85b83bff93784a9133d40cc3fc2b4e987/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f696e73706972756d2f62616c696b6f626f742d7068702e7376673f7374796c653d666c61742d73717561726526636f6c6f72423d626c7565)](./LICENSE.md)

Offers implementation of Balikobot API [v2](https://balikobotv2eng.docs.apiary.io/#introduction/difference-api-v2-vs-api-v1) described in the official [documentation](https://balikobotv2eng.docs.apiary.io/#introduction/summary-of-changes) until **v2.028** *(2026-03-25)*.

More details are available in [changelog](./CHANGELOG.md).

Usage example
-------------

[](#usage-example)

See more available methods' documentation in [Usage](#usage) section.

> *All the code snippets shown here are modified for clarity, so they may not be executable.*

#### Create packages and order shipment

[](#create-packages-and-order-shipment)

```
use Inspirum\Balikobot\Definitions\Carrier;
use Inspirum\Balikobot\Definitions\Country;
use Inspirum\Balikobot\Definitions\Currency;
use Inspirum\Balikobot\Definitions\Service;
use Inspirum\Balikobot\Model\PackageData\DefaultPackageData;
use Inspirum\Balikobot\Model\PackageData\DefaultPackageDataCollection;
use Inspirum\Balikobot\Service\PackageService;

/** @var Inspirum\Balikobot\Service\PackageService $packageService */

// create new package collection for specific carrier
$packagesData = new DefaultPackageDataCollection(Carrier::CP);

// create new package
$packageData = new DefaultPackageData();
$packageData->setServiceType(Service::CP_NP);
$packageData->setRecName('Josef Novák');
$packageData->setRecZip('11000');
$packageData->setRecCountry(Country::CZECH_REPUBLIC);
$packageData->setRecPhone('776555888');
$packageData->setCodPrice(1399.00);
$packageData->setCodCurrency(Currency::CZK);

// add package to collection
$packagesData->add($packageData);

// upload packages to balikobot
$packages = $packageService->addPackages($packagesData);

// save package IDs
$data = [];
$data['packages'] = $packages->getPackageIds();

// save track URL for each package
foreach($packages as $package) {
  $data['trackUrl'][] = $package->getTrackUrl();
}

// order shipment for packages
$orderedShipment = $packageService->orderShipment($orderedPackages);

// save order ID and labels URL
$data['orderId'] = $orderedShipment->getOrderId();
$data['labelsUrl'] = $orderedShipment->getLabelsUrl();
$data['handoverUrl'] = $orderedShipment->getHandoverUrl();

/**
var_dump($data);
[
  'packages' => [
    0 => 42719
    1 => 42720
  ]
  'trackUrl' => [
    0 => 'https://www.postaonline.cz/trackandtrace/-/zasilka/cislo?parcelNumbers=DR00112233M'
    1 => 'https://www.postaonline.cz/trackandtrace/-/zasilka/cislo?parcelNumbers=DR00112234M'
  ]
  'orderId' => 2757
  'labelsUrl' => 'https://pdf.balikobot.cz/cp/eNorMTIwt9A1NbYwM76cMBAXAn4.'
  'handoverUrl' => 'https://pdf.balikobot.cz/cp/eNorMTIwt9A1NbawtARcMBAhAoU.'
]
*/
```

#### Test packages data / delete packages

[](#test-packages-data--delete-packages)

```
use Inspirum\Balikobot\Exception\Exception;

/** @var Inspirum\Balikobot\Service\PackageService $packageService */

// check if packages data is valid
try {
    $packageService->checkPackages($packagesData);
} catch (Exception $exception) {
    return $exception->getErrors();
}

// drop packages if shipment is not ordered yet
$packageService->dropPackages($packages);
```

#### Track packages

[](#track-packages)

```
use Inspirum\Balikobot\Definitions\Status;

/** @var Inspirum\Balikobot\Service\TrackService $trackService */

// track last package status
$status = $trackService->trackPackageLastStatus($packages[0]);
/**
var_dump($status);
Inspirum\Balikobot\Model\Status\DefaultStatus {
  private $carrier => 'cp'
  private $carrierId => '1234'
  private $id => 2.2
  private $name => 'Zásilka byla doručena příjemci.'
  private $description => 'Dodání zásilky. (77072 - Depo Olomouc 72)'
  private $type => 'event'
  private $date => DateTimeImmutable { '2018-07-02 09:15:01.000000' }
}
*/

if (Status::isError($status->getId())) {
  // handle package delivery error
}

if ($status->getId() === Status::COD_PAID) {
  // CoD has been credited to the sender's account
}

if (Status::isDelivered($status->getId())) {
  // handle delivered package
}
```

#### Import branches

[](#import-branches)

```
use Inspirum\Balikobot\Definitions\Carrier;
use Inspirum\Balikobot\Definitions\Country;

/** @var Inspirum\Balikobot\Service\BranchService $branchService */

// get only branches for Zasilkovna in CZ/SK
$branches = $branchService->getBranchesForCarrierAndCountries(
  Carrier::ZASILKOVNA,
  [Country::CZECH_REPUBLIC, Country::SLOVAKIA]
);

foreach($branches as $branch) {
  /**
  var_dump($branch);
  Inspirum\Balikobot\Model\Branch\DefaultBranch {
    private $carrier => 'zasilkovna'
    private $service => null
    private $branchId => '10000'
    private $uid => 'VMCZ-zasilkovna-branch-10000'
    private $id => '10000'
    private $type => 'branch'
    private $name => 'Hradec Králové, Dukelská tř. 1713/7 (OC Atrium - Traficon) Tabák Traficon'
    private $city => 'Hradec Králové'
    private $street => 'Dukelská tř. 1713/7'
    private $zip => '50002'
    private $cityPart => null
    private $district => 'okres Hradec Králové'
    private $region => 'Královéhradecký kraj'
    private $country => 'CZ'
    ...
  }
  */
}
```

System requirements
-------------------

[](#system-requirements)

- [PHP 8.1+](http://php.net/releases/8_1_0.php)
- [ext-curl](http://php.net/curl)
- [ext-json](http://php.net/json)

If you are still using older PHP version, you can use this package in [`^5.0`](https://github.com/inspirum/balikobot-php/tree/5.x) version (for PHP 7.1+).

Installation
------------

[](#installation)

Run composer require command:

```
composer require inspirum/balikobot

```

or add a requirement to your `composer.json`:

```
"inspirum/balikobot": "^7.0"
```

### Setup service

[](#setup-service)

Available framework integrations:

- [Symfony](https://github.com/inspirum/balikobot-php-symfony)
- [Laravel](https://github.com/inspirum/balikobot-php-laravel)
- [Nette](https://github.com/TomasHalasz/balikobot-nette)

But you can also use it without any framework implementation:

```
use Inspirum\Balikobot\Client\DefaultClient;
use Inspirum\Balikobot\Client\DefaultCurlRequester;
use Inspirum\Balikobot\Client\Response\Validator;
use Inspirum\Balikobot\Model\Label\DefaultLabelFactory;
use Inspirum\Balikobot\Model\OrderedShipment\DefaultOrderedShipmentFactory;
use Inspirum\Balikobot\Model\Package\DefaultPackageFactory;
use Inspirum\Balikobot\Model\PackageData\DefaultPackageDataFactory;
use Inspirum\Balikobot\Model\ProofOfDelivery\DefaultProofOfDeliveryFactory;
use Inspirum\Balikobot\Model\Status\DefaultStatusFactory;
use Inspirum\Balikobot\Model\TransportCost\DefaultTransportCostFactory;
use Inspirum\Balikobot\Service\DefaultPackageService;
use Inspirum\Balikobot\Service\DefaultTrackService;

$apiUser = getenv('BALIKOBOT_API_USER');
$apiKey = getenv('BALIKOBOT_API_KEY');

$requester = new DefaultCurlRequester($apiUser, $apiKey, sslVerify: true);
$validator = new Validator();
$client = new DefaultClient($requester, $validator);

$packageService = new DefaultPackageService(
    $client,
    new DefaultPackageDataFactory(),
    new DefaultPackageFactory($validator),
    new DefaultOrderedShipmentFactory(),
    new DefaultLabelFactory(),
    new DefaultProofOfDeliveryFactory($validator),
    new DefaultTransportCostFactory($validator),
);

$trackService = new DefaultTrackService(
    $client,
    new DefaultStatusFactory($validator),
);

// ...
```

Usage
-----

[](#usage)

The module contains several helper classes that contain most of the constants needed to work with the Balikobot API.

- [**Definitions**](./docs/definitions.md)
- [**Package service**](./docs/services.md#package-service)
- [**Track service**](./docs/services.md#track-service)
- [**Branch service**](./docs/services.md#branch-service)
- [**Setting service**](./docs/services.md#setting-service)
- [**Info service**](./docs/services.md#info-service)
- [**Providers**](./docs/services.md#providers)

Testing
-------

[](#testing)

To run unit tests, run:

```
composer test:test

```

You can also run only Unit or Integration test suites, run:

```
composer test:unit
composer test:integration

```

To show coverage, run:

```
composer test:coverage

```

To run all test (phpcs, phpstan, phpunit, etc.), run:

```
composer test

```

For testing purposes, you can use these credentials:

- **API username:** `balikobot_test2cztest`
- **API key:** `#lS1tBVo`

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](./docs/CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](./docs/CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Tomáš Novotný](https://github.com/tomas-novotny)
- [All Contributors](https://github.com/inspirum/balikobot-php/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](./LICENSE.md) for more information.

###  Health Score

64

—

FairBetter than 99% of packages

Maintenance89

Actively maintained with recent releases

Popularity46

Moderate usage in the ecosystem

Community20

Small or concentrated contributor base

Maturity84

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 99.8% 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 ~42 days

Recently: every ~164 days

Total

64

Last Release

54d ago

Major Versions

v6.4.0 → v7.0.02022-08-19

v5.7.1 → v6.2.12023-04-18

v6.2.1 → v7.5.02023-05-15

v5.7.2 → 6.x-dev2023-05-22

v6.4.1 → v7.5.12023-05-22

PHP version history (5 changes)v1.0.0PHP &gt;=7.1.3

v1.4.0PHP &gt;=7.1

v6.0.0PHP &gt;=8.0

v7.0.0PHP &gt;=8.1

v7.2.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/e2804b72261a28767b27deae892144e2a2c6a09a0d71d149631606346731d52d?d=identicon)[tomas-novotny](/maintainers/tomas-novotny)

---

Top Contributors

[![tomas-novotny](https://avatars.githubusercontent.com/u/36948723?v=4)](https://github.com/tomas-novotny "tomas-novotny (401 commits)")[![gabrieltakacs](https://avatars.githubusercontent.com/u/6212368?v=4)](https://github.com/gabrieltakacs "gabrieltakacs (1 commits)")

---

Tags

api-clientapi-wrapperbalikobotcarriersdelivery-apiphpapi clientBalikobot

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/inspirum-balikobot/health.svg)

```
[![Health](https://phpackages.com/badges/inspirum-balikobot/health.svg)](https://phpackages.com/packages/inspirum-balikobot)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[saloonphp/saloon

Build beautiful API integrations and SDKs with Saloon

2.4k9.6M468](/packages/saloonphp-saloon)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69433.0M114](/packages/algolia-algoliasearch-client-php)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.5k311.5k5](/packages/theodo-group-llphant)[php-heroku-client/php-heroku-client

A PHP client for the Heroku Platform API

24404.8k4](/packages/php-heroku-client-php-heroku-client)[smsapi/php-client

SMSAPI API PHP Client

652.1M17](/packages/smsapi-php-client)

PHPackages © 2026

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