PHPackages                             madmis/kuna-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. [HTTP &amp; Networking](/categories/http)
4. /
5. madmis/kuna-api

AbandonedArchivedLibrary[HTTP &amp; Networking](/categories/http)

madmis/kuna-api
===============

Kuna.io REST API php client

1.1.3(8y ago)7243↓100%6[2 PRs](https://github.com/madmis/kuna-api/pulls)MITPHPPHP ^7.1

Since Jul 21Pushed 3y ago2 watchersCompare

[ Source](https://github.com/madmis/kuna-api)[ Packagist](https://packagist.org/packages/madmis/kuna-api)[ RSS](/packages/madmis-kuna-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (13)Used By (0)

Kuna.io REST API PHP Client
===========================

[](#kunaio-rest-api-php-client)

[![SensioLabsInsight](https://camo.githubusercontent.com/a5f2c73b18795434fac92e3423523f74ff777bacd2421be0b6647358e5a7d1c2/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f37373135323838332d343132652d346139312d383662362d6662393736323433613032302f6d696e692e706e67)](https://insight.sensiolabs.com/projects/77152883-412e-4a91-86b6-fb976243a020)[![Build Status](https://camo.githubusercontent.com/4f067f87eae1041d3c7ee0bed866f6bf809ba703ef1db5d2669c824f07abbfaa/68747470733a2f2f7472617669732d63692e6f72672f6d61646d69732f6b756e612d6170692e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/madmis/kuna-api)[![Coverage Status](https://camo.githubusercontent.com/a989db96f36afd112e6a7232c804b0511e1470afe4bca706d66322833f07cc34/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6d61646d69732f6b756e612d6170692f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/madmis/kuna-api?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/2d001b912cd40eaf13fab7977162c687a11a8060f3f269ec95d22613a8d78795/68747470733a2f2f706f7365722e707567782e6f72672f6d61646d69732f6b756e612d6170692f762f737461626c65)](https://packagist.org/packages/madmis/kuna-api)[![Total Downloads](https://camo.githubusercontent.com/a42b392b99147c90e77c41eaf2bf6ae4ba912345f5b9773c0e960447605a1830/68747470733a2f2f706f7365722e707567782e6f72672f6d61646d69732f6b756e612d6170692f646f776e6c6f616473)](https://packagist.org/packages/madmis/kuna-api)[![License](https://camo.githubusercontent.com/8076cea462a42fe4e4b4818efaa212acaebf3a9aaaba4da0677009ca21f77b08/68747470733a2f2f706f7365722e707567782e6f72672f6d61646d69732f6b756e612d6170692f6c6963656e7365)](https://packagist.org/packages/madmis/kuna-api)

[Kuna.io](https://kuna.io/documents/api) provides REST APIs that you can use to interact with platform programmatically.

This API client will help you interact with Kuna by REST API.

Table Of Contents
-----------------

[](#table-of-contents)

- [License](#license)
- [Kuna REST API Reference](#kuna-rest-api-reference)
- [Contributing](#contributing)
- [Install](#install)
- [Usage](#usage)
    - [Mapping](#mapping)
    - [Error handling](#error-handling)
- [Running the tests](#running-the-tests)
    - [Running Unit tests](#running-unit-tests)
- [Library api](#library-api)
    - [Shared resources (Public Kuna API)](#shared-resources-public-kuna-api)
    - [Private resources (Private Kuna API) ](#private-resources-private-kuna-api)

License
-------

[](#license)

MIT License

Kuna REST API Reference
-----------------------

[](#kuna-rest-api-reference)

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

[](#contributing)

To create new endpoint - [create issue](https://github.com/madmis/kuna-api/issues/new)or [create pull request](https://github.com/madmis/kuna-api/compare)

Install
-------

[](#install)

```
composer require cryptopupua/kuna-api 1.1.*

```

Usage
-----

[](#usage)

```
require __DIR__.'/vendor/autoload.php';

use cryptopupua\KunaApi\Api;
use cryptopupua\KunaApi\Exception\IncorrectResponseException;
use cryptopupua\KunaApi\KunaApi;
use cryptopupua\KunaApi\Model\History;
use cryptopupua\KunaApi\Model\MyAccount;
use cryptopupua\KunaApi\Model\Order;
use cryptopupua\KunaApi\Model\Ticker;

$api = new KunaApi(
    'https://kuna.io',
    'public key',
    'secret key'
);
$timestamp = $api->shared()->timestamp();
```

### Mapping

[](#mapping)

Each endpoint response (exclude: timestamp) can be received as `array` or as `object`.

To use mapping response to `object` set parameter `$mapping` to `true`.

```
$issue = $api->signed()->activeOrders(Http::PAIR_ETHUAH, true);

// Result
[
    {
    class madmis\KunaApi\Model\Order {
        protected $id => 10003
        protected $side => "sell"
        protected $ordType => "limit"
        protected $price => 10000
        protected $avgPrice => 0
        protected $state => "wait"
        protected $market => "ethuah"
        protected $createdAt => DateTime
        protected $volume => 0.01
        protected $volume => 0.01
        protected $remainingVolume => 0.01
        protected $executedVolume => 0
        protected $tradesCount => 0
      }

    },
    ...
]
```

### Error handling

[](#error-handling)

Each client request errors wrapped to custom exception **madmis\\ExchangeApi\\Exception\\ClientException**

```
class madmis\ExchangeApi\Exception\ClientException {
  private $request => class GuzzleHttp\Psr7\Request
  private $response => NULL
  protected $message => "cURL error 7: Failed to connect to 127.0.0.1 port 8080: Connection refused (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)"
  ...
}
```

**ClientException** contains original **request object** and **response object** if response available

```
class madmis\ExchangeApi\Exception\ClientException {
  private $request => class GuzzleHttp\Psr7\Request
  private $response => class GuzzleHttp\Psr7\Response {
    private $reasonPhrase => "Unauthorized"
    private $statusCode => 401
    ...
  }
  protected $message => "Client error: 401"
  ...
}
```

So, to handle errors use try/catch

```
try {
    $api->signed()->activeOrders(Http::PAIR_ETHUAH, true);
} catch (madmis\ExchangeApi\Exception\ClientException $ex) {
    // any actions (log error, send email, ...)
}
```

Running the tests
-----------------

[](#running-the-tests)

To run the tests, you'll need to install [phpunit](https://phpunit.de/). Easiest way to do this is through composer.

```
composer install

```

### Running Unit tests

[](#running-unit-tests)

```
php vendor/bin/phpunit -c phpunit.xml.dist

```

Library api
-----------

[](#library-api)

### Shared resources (Public Kuna API)

[](#shared-resources-public-kuna-api)

- [Time from the exchange server](https://kuna.io/api/v2/timestamp)

    ```
    $timestamp = $api->shared()->timestamp();
    ```
- [Recent Market Data](https://kuna.io/api/v2/tickers/btcuah)

    ```
      $tickers = $api->shared()->tickers('btcuah');
    ```
- [Order Book](https://kuna.io/api/v2/order_book?market=btcuah)

    ```
      $orders = $api->shared()->orderBook('btcuah');
    ```
- [Asks Order Book](https://kuna.io/api/v2/order_book?market=btcuah)

    ```
      $orders = $api->shared()->asksOrderBook('btcuah');
    ```
- [Bids Order Book](https://kuna.io/api/v2/order_book?market=btcuah)

    ```
      $orders = $api->shared()->bidsOrderBook('btcuah');
    ```
- [Trades History](https://kuna.io/api/v2/trades?market=btcuah)

    ```
      $orders = $api->shared()->tradesHistory('btcuah');
    ```

### Private resources (Private Kuna API)

[](#private-resources-private-kuna-api)

- [Information About the User and Assets](https://kuna.io/api/v2/members/me)

    ```
      $orders = $api->signed()->me();
    ```
- [Order Placing - create BUY order](https://kuna.io/api/v2/orders)

    ```
      $orders = $api->signed()->createBuyOrder('btcuah', 1.00, 350000, true);
    ```
- [Order Placing - create SELL order](https://kuna.io/api/v2/orders)

    ```
      $orders = $api->signed()->createSellOrder('btcuah', 1.00, 420000, true);
    ```
- [Order Cancel](https://kuna.io/api/v2/order/delete)

    ```
      $orders = $api->signed()->cancelOrder(124578, true);
    ```
- [Active User Orders](https://kuna.io/api/v2/orders)

    ```
      $orders = $api->signed()->activeOrders('btcuah', true);
    ```
- [User Trade History](https://kuna.io/api/v2/trades/my)

    ```
      $orders = $api->signed()->myHistory('btcuah', true);
    ```

###  Health Score

33

—

LowBetter than 74% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

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

Recently: every ~45 days

Total

10

Last Release

3029d ago

Major Versions

0.1.0 → 1.0.02017-07-21

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1774703?v=4)[Dmytro](/maintainers/madmis)[@madmis](https://github.com/madmis)

---

Top Contributors

[![madmis](https://avatars.githubusercontent.com/u/1774703?v=4)](https://github.com/madmis "madmis (1 commits)")[![stgodjah](https://avatars.githubusercontent.com/u/43356590?v=4)](https://github.com/stgodjah "stgodjah (1 commits)")

---

Tags

api-clientbitcoincryptocurrencykunarestapirestkuna.iokuna

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/madmis-kuna-api/health.svg)

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

###  Alternatives

[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.3k63.6M232](/packages/nelmio-api-doc-bundle)

PHPackages © 2026

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