PHPackages                             radianceteam/ton-client-php - 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. radianceteam/ton-client-php

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

radianceteam/ton-client-php
===========================

TON Client Wrapper for PHP

1.38.0(3y ago)133783[1 issues](https://github.com/radianceteam/everscale-client-php/issues)Apache-2.0PHPPHP &gt;=7.4

Since Nov 18Pushed 3y ago2 watchersCompare

[ Source](https://github.com/radianceteam/everscale-client-php)[ Packagist](https://packagist.org/packages/radianceteam/ton-client-php)[ RSS](/packages/radianceteam-ton-client-php/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (4)Versions (63)Used By (0)

TON Client Wrapper for PHP
==========================

[](#ton-client-wrapper-for-php)

**Community links:**

[![Chat on Telegram](https://camo.githubusercontent.com/c918be5340240e5a3031f4a5e4890347abaeac6f4f4fefef01095cb7825b9a2d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636861742d6f6e25323074656c656772616d2d3963662e737667)](https://t.me/RADIANCE_TON_SDK)

True async wrapper powered by [ton\_client](https://github.com/radianceteam/ton-client-php-ext/)extension with multi-threading and blocking queues under the hood.

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

[](#requirements)

- PHP version 7.4+ or 8.0+.
- Composer ()

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

[](#installation)

1. Install [TON Client PHP extension](https://github.com/radianceteam/ton-client-php-ext) as described in [readme](https://github.com/radianceteam/ton-client-php-ext/blob/master/INSTALL.md).
2. Run `composer`:

```
composer require radianceteam/ton-client-php
```

Usage examples
--------------

[](#usage-examples)

### Basic example

[](#basic-example)

```
use TON\TonClient;

$client = new TonClient();
$result = $client->client()->version();
echo "TON SDK Version: {$result->getVersion()}";
```

### Configuration &amp; Logging

[](#configuration--logging)

```
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
use TON\Client\ClientConfig;
use TON\Client\NetworkConfig;
use TON\TonClientBuilder;

$client = TonClientBuilder::create()
    ->withConfig((new ClientConfig())
        ->setNetwork((new NetworkConfig())
            ->setServerAddress(getenv('TON_NETWORK_ADDRESS'))))
    ->withLogger((new Logger("demo"))
        ->pushHandler(new StreamHandler('demo.log', Logger::DEBUG)))
    ->build();
```

### Handling async events

[](#handling-async-events)

Each module interface has `async()` function which returns asynchronous interface version. Note that some functions, like in processing module, have async versions only.

```
use TON\TonClient;
use TON\Net\ParamsOfWaitForCollection;

$client = new TonClient();

$promise = $client->net()->async()->waitForCollectionAsync(
    (new ParamsOfWaitForCollection())
        ->setCollection("transactions")
        ->setFilter(["now" => ["gt" => time()]])
        ->setResult("id now"));

echo "Awaiting for new transactions...";
$result = $promise->await();
```

### Subscribing to events

[](#subscribing-to-events)

Async interface also allows processing events occurred between function start and finish. This can be achieved via calling `getEvents()` function of the returned promise. Note this blocks the current program flow until the new event fired, or the unsubscribe function called.

```
use TON\Abi\CallSet;
use TON\Abi\Abi_Contract;
use TON\Abi\DeploySet;
use TON\Abi\Signer_Keys;
use TON\Abi\ParamsOfEncodeMessage;
use TON\Client\ClientConfig;
use TON\Client\NetworkConfig;
use TON\Net\ParamsOfSubscribeCollection;
use TON\TestClient;
use TON\TonClientBuilder;

$client = TonClientBuilder::create()
    ->withConfig((new ClientConfig())
        ->setNetwork((new NetworkConfig())
            ->setServerAddress(getenv('TON_NETWORK_ADDRESS'))))
    ->build();

$keys = $client->crypto()->generateRandomSignKeys();

$msg = $client->abi()->encodeMessage((new ParamsOfEncodeMessage())
    ->setAbi((new Abi_Contract())
        ->setValue(TestClient::load_abi('Hello')))
    ->setDeploySet((new DeploySet())
        ->setTvc(TestClient::load_tvc('Hello')))
    ->setSigner((new Signer_Keys())->setKeys($keys))
    ->setCallSet((new CallSet())
        ->setFunctionName("constructor")));

$subscribePromise = $client->net()->async()
    ->subscribeCollectionAsync((new ParamsOfSubscribeCollection())
        ->setCollection("transactions")
        ->setFilter([
            "account_addr" => ["eq" => $msg->getAddress()],
            "status" => ["eq" => 3] // Finalized
        ])
        ->setResult("id account_addr"));

// Wait for the very first event, then unsubscribe
$handle = $subscribePromise->await();
foreach ($subscribePromise->getEvents() as $event) {
    var_dump($event);
    $client->net()->unsubscribe($handle);
}
```

### Other

[](#other)

See more examples in [demo](demo) folder.

Docker images
-------------

[](#docker-images)

All Docker images are based on `alpine` image. They contain the corresponding PHP interpreter from the [original PHP image](https://hub.docker.com/_/php)with [ton-client](https://github.com/radianceteam/ton-client-php-ext) extension preinstalled.

### How to use Docker images

[](#how-to-use-docker-images)

Use [radianceteam/ton-client-php](https://hub.docker.com/r/radianceteam/ton-client-php)as a base image in your `Dockerfile`:

```
FROM radianceteam/ton-client-php:1.38.0-php7.4-cli
COPY . /usr/src/myapp
WORKDIR /usr/src/myapp
CMD [ "php", "./your-script.php" ]
```

Basically, do anything you can do with the [original PHP image](https://hub.docker.com/_/php)by just replacing `FROM php:-` with `FROM radianceteam/ton-client-php:1.38.0-php-`.

Note: only `cli`, `fpm` and `zts` variants are supported ATM.

### TODO

[](#todo)

Add `apache` variant based on Debian Buster image, as in the original PHP repo.

Development
-----------

[](#development)

See [Development notes](development.md).

License
-------

[](#license)

Apache License, Version 2.0.

Troubleshooting
---------------

[](#troubleshooting)

Fire any question to our [Telegram channel](https://t.me/RADIANCE_TON_SDK).

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity68

Established project with proven stability

 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

Every ~12 days

Recently: every ~27 days

Total

61

Last Release

1328d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/21310402?v=4)[Andrew Anisimov](/maintainers/andy-a-o)[@andy-a-o](https://github.com/andy-a-o)

---

Top Contributors

[![andy-a-o](https://avatars.githubusercontent.com/u/21310402?v=4)](https://github.com/andy-a-o "andy-a-o (98 commits)")

---

Tags

blockchainfreetonfreeton-sdkphptonton-client

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/radianceteam-ton-client-php/health.svg)

```
[![Health](https://phpackages.com/badges/radianceteam-ton-client-php/health.svg)](https://phpackages.com/packages/radianceteam-ton-client-php)
```

###  Alternatives

[symfony/lock

Creates and manages locks, a mechanism to provide exclusive access to a shared resource

514139.2M682](/packages/symfony-lock)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

564576.7k49](/packages/ecotone-ecotone)[civicrm/civicrm-core

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

751291.4k41](/packages/civicrm-civicrm-core)[illuminate/broadcasting

The Illuminate Broadcasting package.

7127.2M208](/packages/illuminate-broadcasting)[logiscape/mcp-sdk-php

Model Context Protocol SDK for PHP

368116.8k12](/packages/logiscape-mcp-sdk-php)

PHPackages © 2026

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