PHPackages                             smartilabs/metakocka - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. smartilabs/metakocka

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

smartilabs/metakocka
====================

036PHPCI failing

Since Jul 25Pushed 5y ago1 watchersCompare

[ Source](https://github.com/smartilabs/metakocka)[ Packagist](https://packagist.org/packages/smartilabs/metakocka)[ RSS](/packages/smartilabs-metakocka/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

MetaKocka API wrapper module
============================

[](#metakocka-api-wrapper-module)

usage
-----

[](#usage)

### init client

[](#init-client)

```
$companyID = 1234;
$secretKey = "secret_code";

$client = new \Smarti\Metakocka\Client($companyID, $secretKey);
```

### get product list

[](#get-product-list)

```
$data = new \Smarti\Metakocka\Resource\Product\ListRequest();
$data->setSales(true);
$productList = $client->getProductList($data);

$count = $productList->getProductListCount();
foreach ($productList->getProductList() as $product) {
    echo $product->getName();
}
```

### create product

[](#create-product)

```
$data = new \Smarti\Metakocka\Resource\Product\ItemRequest();

$data->setCode('unique_code_123456');
$data->setName('Beautiful product name');
$data->setSales(true);
$data->setService(true);

$product = $client->createProduct($data);
```

### create bill

[](#create-bill)

```
$data = new \Smarti\Metakocka\Resource\Sales\BillRequest();

$data->setBillDate(new DateTime());
$data->setPaymentDate((new DateTime())->add(new DateInterval('P8D')));

$partner = new \Smarti\Metakocka\Resource\Partner\PartnerRequest();
$partner->setBusinessEntity(false);
$partner->setCustomer('John Doe');
$partner->setStreet('Elm street 10');
$partner->setPostNumber('1000');
$partner->setPlace('Ljubljana');
$data->setPartner($partner);

$product1 = new \Smarti\Metakocka\Resource\Product\ItemRequest();
$product1->setMkId(555500000000); // or $product1->setCountCode('unique_code_123456');
$product1->setAmount(1);
$product1->setPrice(round(55.9 / 1.22, 4)); // price without tax
$product1->setTax(\Smarti\Metakocka\Enum\Tax::TAX_220);

$data->addProduct($product1);

$bill = $client->createBill($data);
```

### get bill PDF

[](#get-bill-pdf)

```
$data = new \Smarti\Metakocka\Resource\Sales\BillPdfRequest();

$billCountCode = '2016-123456';

$data->setHideCode(true);
$data->setCountCode($billCountCode);

$rawPdfData = $client->getBillPdf($data);

// write response into file
$fileName = $billCountCode . '.pdf';
$fh = fopen($fileName, 'w');
fwrite($fh, $rawPdfData);
fclose($fh);
```

!! important note !!
--------------------

[](#-important-note-)

Currently API only has some methods. Other methods will (maybe) come eventually, if needed. Warning: this is not official API, nor is officially supported, so use it at your own risk. But you can contact me for any questions :)

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/b4b89fd414bdc5a12a75543759c8353436ec3ba5e75ed51932618fdf798fd337?d=identicon)[smartilabs](/maintainers/smartilabs)

---

Top Contributors

[![bostjan-preskok](https://avatars.githubusercontent.com/u/36704543?v=4)](https://github.com/bostjan-preskok "bostjan-preskok (10 commits)")[![smartilabs](https://avatars.githubusercontent.com/u/6381175?v=4)](https://github.com/smartilabs "smartilabs (5 commits)")

### Embed Badge

![Health badge](/badges/smartilabs-metakocka/health.svg)

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

###  Alternatives

[philippoehrlein/typo-and-paste

A Kirby plugin for managing and inserting special characters with multi-language support.

415.5k](/packages/philippoehrlein-typo-and-paste)

PHPackages © 2026

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