PHPackages                             happyslucker/changenow-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. happyslucker/changenow-api

ActiveLibrary[API Development](/categories/api)

happyslucker/changenow-api
==========================

PHP library for ChangeNow cryptocurrency exchange REST API

1.0.0(1mo ago)00MITPHPPHP &gt;=8.4

Since Jun 23Pushed 1mo agoCompare

[ Source](https://github.com/HappySlucker/ChangeNowApi)[ Packagist](https://packagist.org/packages/happyslucker/changenow-api)[ RSS](/packages/happyslucker-changenow-api/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

[![ChangeNOW](logo.png)](logo.png)

[![PHP Version](https://camo.githubusercontent.com/5c4fde178293808fc8e069ac46368595f4a50dad93e207e18ec9e360d9e08a69/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e342d3737376262342e7376673f7374796c653d666c61742d737175617265)](https://www.php.net/)[![License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Type](https://camo.githubusercontent.com/142064098c8e54c767ae6306e82698cd1c004746bcc13286aa9221f0c90d67c2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f747970652d6c6962726172792d626c75652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/happyslucker/changenow-api)

About ChangeNOW API
===================

[](#about-changenow-api)

---

**ChangeNOW API** is a type-safe, feature-complete PHP library for the [ChangeNOW](https://changenow.io) cryptocurrency exchange REST API. It wraps both v1 and v2 endpoints with strictly typed DTOs, modular services, and full test coverage — no magic arrays, no guesswork.

✨ Features
----------

[](#-features)

---

- **Full API Coverage:** All 29 endpoints from v1 and v2 — currencies, rates, exchanges, private transfers, address validation, and more.
- **Strictly Typed DTOs:** Every response is a `readonly` value object with a static `fromArray()` factory and full PHPDoc generics.
- **Modular Architecture:** Separate service classes per API section (`common()`, `standardFlow()`, `fixedRateFlow()`, `markets()`, etc.).
- **PSR-compliant HTTP:** Built on `GuzzleHttp\ClientInterface` — inject your own client for mocking or custom middleware.
- **Tested:** 40+ PHPUnit tests covering every endpoint, including error responses and edge cases.
- **API Key Authentication:** Automatically sent via `x-api-key` header — no manual header management.

📦 Installation
--------------

[](#-installation)

---

Ensure you have `ext-curl` and `ext-json` installed.

```
composer require happyslucker/changenow-api
```

🚀 Quick Start
-------------

[](#-quick-start)

---

### 1. Fetch Available Currencies

[](#1-fetch-available-currencies)

Retrieve all tradable assets from the ChangeNOW platform.

```
use ChangeNow\ChangeNowClient;

$client = new ChangeNowClient('your-api-key');

$currencies = $client->common()->getCurrencies();

foreach ($currencies as $currency) {
    echo $currency->ticker . ' — ' . $currency->name . PHP_EOL;
}
```

### 2. Estimate &amp; Create an Exchange

[](#2-estimate--create-an-exchange)

Get a rate estimate and immediately create a standard-flow transaction.

```
use ChangeNow\ChangeNowClient;
use ChangeNow\Model\Request\CreateExchangeRequest;

$client = new ChangeNowClient('your-api-key');

// Step 1: Estimate
$estimate = $client->standardFlow()->getEstimatedAmount('btc', 'eth', '1');
echo "You'll receive: {$estimate->estimatedAmount} ETH" . PHP_EOL;

// Step 2: Create exchange
$request = new CreateExchangeRequest(
    fromCurrency: 'btc',
    toCurrency: 'eth',
    address: '0xRecipientAddress',
    fromAmount: '1',
    refundAddress: '1MyRefundAddress',
);
$exchange = $client->standardFlow()->createExchange($request);

echo "Exchange ID: {$exchange->id}" . PHP_EOL;
echo "Send BTC to: {$exchange->payinAddress}" . PHP_EOL;
```

### 3. Fixed-Rate Exchange (Reverse)

[](#3-fixed-rate-exchange-reverse)

Create a fixed-rate transaction where you specify the exact output amount.

```
use ChangeNow\ChangeNowClient;
use ChangeNow\Model\Request\CreateExchangeRequest;

$client = new ChangeNowClient('your-api-key');

$request = new CreateExchangeRequest(
    fromCurrency: 'btc',
    toCurrency: 'eth',
    address: '0xRecipient',
    fromAmount: '1',
    toAmount: '15.5',          // exact desired output
    flow: 'fixed-rate',
    type: 'reverse',
);

$exchange = $client->fixedRateFlow()->createExchange($request);
echo "{$exchange->id} — send {$exchange->amountExpectedFrom} BTC";
```

### 4. Validate an Address

[](#4-validate-an-address)

Check if a cryptocurrency address is valid before sending funds.

```
$result = $client->validate()->address('btc', '1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa');

echo $result->result
    ? '✓ Address is valid'
    : "✗ Invalid: {$result->message}";
```

🛠️ Architecture
---------------

[](#️-architecture)

---

### Module Structure

[](#module-structure)

The library is split into domain-aligned services, each accessible via a lazy-loaded property on the client.

ServiceEndpointsDescription`$client->common()`v1Currencies, pairs, transaction status`$client->standardFlow()`v1Floating-rate estimation &amp; creation`$client->fixedRateFlow()`v1Fixed-rate markets &amp; creation`$client->markets()`v2Currencies, amounts, ranges, estimates`$client->exchangeActions()`v2Continue / refund public exchanges`$client->privateTransfer()`v2Private transfer estimation &amp; creation`$client->validate()`v2Address &amp; user address validation`$client->v2Exchange()`v2V2 exchange CRUD### Data Transfer Objects

[](#data-transfer-objects)

Every API response is mapped to a `readonly` DTO. No associative arrays leak out of the library — you always work with typed objects.

```
$tx = $client->common()->getTransactionStatus('abc123');

echo $tx->status->value;           // enum-backed string
echo $tx->fromCurrency;            // string
echo $tx->amountExpectedTo;       // string (numeric, atomic precision)
```

### Exception Handling

[](#exception-handling)

All API errors throw `ChangeNowException` with the upstream message and HTTP status code.

```
use ChangeNow\Exception\ChangeNowException;

try {
    $client->common()->getCurrencies();
} catch (ChangeNowException $e) {
    echo "API error [{$e->getCode()}]: {$e->getMessage()}";
}
```

⚙️ Requirements
---------------

[](#️-requirements)

---

- **PHP:** 8.4 or higher
- **Extensions:**
    - `curl` — Required by Guzzle for HTTP transport
    - `json` — Required for request/response serialisation
    - `mbstring` — Recommended for multibyte string handling

📜 License
---------

[](#-license)

---

The MIT License (MIT).

### Created by HappySlucker. Happy coding! 🍻

[](#created-by-happyslucker-happy-coding-)

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance90

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

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

Unknown

Total

1

Last Release

45d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/248821202?v=4)[Pavel Bobrik](/maintainers/HappySlucker)[@HappySlucker](https://github.com/HappySlucker)

---

Top Contributors

[![HappySlucker](https://avatars.githubusercontent.com/u/248821202?v=4)](https://github.com/HappySlucker "HappySlucker (2 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/happyslucker-changenow-api/health.svg)

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

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.2k555.0M2.8k](/packages/aws-aws-sdk-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

293.1k](/packages/eslazarev-wildberries-sdk)[sylius/sylius

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

8.5k6.0M766](/packages/sylius-sylius)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19467.3M1.9k](/packages/drupal-core)[linecorp/line-bot-sdk

SDK of the LINE BOT API for PHP

7353.3M22](/packages/linecorp-line-bot-sdk)[theodo-group/llphant

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

1.7k441.1k7](/packages/theodo-group-llphant)

PHPackages © 2026

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