PHPackages                             olifanton/ton - 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. olifanton/ton

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

olifanton/ton
=============

PHP library for The Open Network blockchain

1.5.5(8mo ago)8849.8k—0.3%13[9 issues](https://github.com/olifanton/ton/issues)2MITPHPPHP &gt;=8.1CI passing

Since May 9Pushed 8mo ago3 watchersCompare

[ Source](https://github.com/olifanton/ton)[ Packagist](https://packagist.org/packages/olifanton/ton)[ Docs](https://github.com/olifanton/ton)[ RSS](/packages/olifanton-ton/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (19)Versions (25)Used By (2)

PHP SDK for "The Open Network" blockchain
-----------------------------------------

[](#php-sdk-for-the-open-network-blockchain)

[![Tests](https://github.com/olifanton/ton/actions/workflows/tests.yml/badge.svg)](https://github.com/olifanton/ton/actions/workflows/tests.yml/badge.svg)[![Latest Stable Version](https://camo.githubusercontent.com/c7ce7df9be814ec02c4a17507081df18963a81385e397a3f9a20a49eada9dc38/68747470733a2f2f706f7365722e707567782e6f72672f6f6c6966616e746f6e2f746f6e2f762f737461626c65)](https://packagist.org/packages/olifanton/ton)[![Total Downloads](https://camo.githubusercontent.com/17537cacfba5a42f586564f235308a7b97e382026e80e8fd9c6cd29183ebc770/68747470733a2f2f706f7365722e707567782e6f72672f6f6c6966616e746f6e2f746f6e2f646f776e6c6f616473)](https://packagist.org/packages/olifanton/ton)[![Based on TON](https://camo.githubusercontent.com/1ca976f32a43d418b083eb6c4d5ca6a62543647b566b00fa7494bf50d86268fa/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f42617365642532306f6e2d544f4e2d626c7565)](https://camo.githubusercontent.com/1ca976f32a43d418b083eb6c4d5ca6a62543647b566b00fa7494bf50d86268fa/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f42617365642532306f6e2d544f4e2d626c7565)[![Donation](https://camo.githubusercontent.com/c338b2ac5738fa9e0010c54207e1d24a9b53822c47b0c04248dec5c457a0f04b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f6e6174652d537570706f72742d2532333030393865613f7374796c653d666c6174266c6f676f3d746f6e266c6f676f436f6c6f723d7768697465)](https://github.com/olifanton#donation)

---

[💬 En chat](https://t.me/olifanton_en) | [💬 Ру чат](https://t.me/olifanton_ru)

Prerequisites
-------------

[](#prerequisites)

- Minimum PHP 8.1;
- `ext-hash`;
- `ext-sodium` required as default cryptographic implementation;
- any httplug-compatible HTTP client (`php-http/client-common`), see [Documentation](https://docs.php-http.org/en/latest/clients.html);
- `ext-bcmath` not required, but strongly recommended for performance reasons.

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

[](#installation)

```
composer require olifanton/ton
```

Examples
--------

[](#examples)

See [`examples`](./examples) directory.

### Running examples

[](#running-examples)

1. Clone repository and install with development dependencies;
2. Get own testnet API key for Toncenter from [Telegram bot](https://t.me/tonapibot);
3. Copy `.env.dist` to `.env`;
4. Put API key and seed phrase variables to `.env` file;
5. Run examples in console.

Documentation
-------------

[](#documentation)

### Toncenter transport initialization

[](#toncenter-transport-initialization)

To use the SDK via Toncenter API, an HTTP client implementation is required. For the example, Guzzle will be used. If you are using another HTTP client supplied by your framework, refer to your framework's documentation and the [`httplug` documentation](https://docs.php-http.org/en/latest/index.html) for additional information.

1. Install http components via Composer:

```
composer require guzzlehttp/guzzle http-interop/http-factory-guzzle php-http/guzzle7-adapter
```

2. Setup Toncenter transport:

```
